{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import json\n",
    "import os\n",
    "from dotenv import load_dotenv\n",
    "from langchain_community.graphs import Neo4jGraph\n",
    "from langchain_community.chat_models import ChatOllama\n",
    "from langchain.document_loaders import WikipediaLoader\n",
    "from langchain_community.llms import Ollama\n",
    "from langchain.chains import LLMChain\n",
    "from langchain.prompts.chat import (ChatPromptTemplate,HumanMessagePromptTemplate,SystemMessagePromptTemplate)\n",
    "from langchain import PromptTemplate\n",
    "from langchain_core.prompts import FewShotPromptTemplate, PromptTemplate\n",
    "from langchain.schema import (SystemMessage,HumanMessage,AIMessage)\n",
    "from langchain_core.output_parsers import JsonOutputParser\n",
    "from langchain_core.pydantic_v1 import BaseModel, Field\n",
    "from langchain_groq import ChatGroq\n",
    "load_dotenv()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "groq_api = os.getenv(\"GROQ_API_KEY\")\n",
    "\n",
    "# Neo4j \n",
    "neo4j_url = os.getenv(\"NEO4J_CONNECTION_URL\")\n",
    "neo4j_user = os.getenv(\"NEO4J_USER\")\n",
    "neo4j_password = os.getenv(\"NEO4J_PASSWORD\")\n",
    "\n",
    "# https://api.python.langchain.com/en/latest/graphs/langchain_community.graphs.neo4j_graph.Neo4jGraph.html\n",
    "graph = Neo4jGraph(neo4j_url,neo4j_user,neo4j_password)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# How to Load Any Text?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. Text Loader (.txt, .md)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Document(page_content='= FIRST ITERATION = \\nTimothy D. Cook is the CEO of Apple Inc., who joined the company in 1998 and took over as CEO in 2009. \\nUnder his leadership, Apple became the world\\'s largest company by market capitalization and revenue, thanks to cost-saving measures such as long-term deals for flash memory that led to popular devices like the iPod Nano, iPhone, and iPad. \\nApple was founded in 1976 by Steve Jobs, Steve Wozniak, and Ronald Wayne, with the Macintosh computer, introduced in 1984, being a revolutionary graphical user interface-based system designed for the masses. \\nThe Macintosh team, led by Jef Raskin and later Steve Jobs, faced challenges in bringing the revolutionary design to life but generated cult enthusiasm with new programs like PageMaker, MORE, and Excel. \\nApple released improved versions of the Macintosh, like the Macintosh 512K, to address initial limitations. \\nApple bought NeXT in 1997, bringing Jobs back as CEO, resulting in game-changing products like the iMac, iPod, iPhone, and iPad.  \\n\\n= SECOND ITERATION = \\nTimothy D. Cook is the CEO of Apple Inc., a globally leading technology company founded in 1976 by Steve Wozniak and Steve Jobs. \\nAfter working at IBM, Cook joined Apple in 1998 and led inventory reduction measures and long-term investments in advanced technology, contributing significantly to Apple\\'s successful transformation. \\nApple revolutionized the computer industry with groundbreaking products like the Apple I, II, Lisa, Macintosh, and subsequent innovations. \\nHowever, the company faced internal issues and financial difficulties in the late 1980s and 1990s, leading to Jobs\\' departure and Wozniak\\'s withdrawal. \\nTo revive Apple, the company bought NeXT and reintroduced Jobs, who returned Apple to profitability. \\nDespite its successes, Apple faces challenges related to contractors\\' labor and environmental practices, business ethics, anti-competitive behaviors, materials sourcing, and brand loyalty. \\nCook is an advocate for political reform and engages in charitable giving. \\nThroughout its history, Apple has been recognized as a trailblazing technology company with milestones such as becoming the first U.S. company valued over $1 trillion, $2 trillion, and $3 trillion. \\nKey figures in Apple\\'s development include Wozniak, Jobs, Raskin, and Cook.\\n\\n= THIRD ITERATION = \\nTimothy D. Cook is the CEO of Apple Inc. since 2009, a globally leading technology company founded in 1976 by Steve Wozniak and Steve Jobs. \\nAfter working at IBM, Cook joined Apple in 1998 and led inventory reduction measures and long-term investments in flash memory that led to popular devices like the iPod Nano, iPhone, and iPad, contributing significantly to Apple\\'s successful transformation. \\nThe first Macintosh computer, introduced in 1984, being a revolutionary graphical user interface-based system designed for the masses.\\nHowever, the company faced internal issues and financial difficulties in the late 1980s and 1990s, leading to Jobs\\' departure and Wozniak\\'s withdrawal. \\nTo revive Apple, the company bought NeXT in 1997 and reintroduced Jobs, who returned Apple to profitability through products like iMac, iPhone, and iPad. \\nIn 2007, Apple, under Jobs\\' leadership, collaborated with Cingular (later AT&T) to develop the iPhone, a revolutionary smartphone featuring multi-touch technology, Touch ID, Face ID, and other innovative features, which has sold over 2.2 billion units as of 2018 and revolutionized the mobile phone industry. \\nApple also operates the App Store, a digital marketplace for apps on various devices, but faces accusations of monopolistic practices. \\nApple\\'s mapping service development began with the acquisition of Placebase in 2009, leading to the formation of Apple Maps. \\nThe company has explored opportunities to enter the automotive industry, including \"Project Titan,\" which involved developing electric and self-driving car technology but was later canceled in 2024. \\n\\n\\n\\n', metadata={'source': 'raw_summary.txt'})]\n"
     ]
    }
   ],
   "source": [
    "from langchain.document_loaders import TextLoader\n",
    "loader = TextLoader('raw_summary.txt')\n",
    "documents = loader.load()\n",
    "print(documents)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2. PDF Loader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Document(page_content='How Good Are Low-bit Quantized LLAMA3 Models?\\nAn Empirical Study\\nWei Huang∗\\nThe University of Hong Kong\\nweih@connect.hku.hkXudong Ma∗\\nBeihang University\\nmacaronlin@buaa.edu.cn\\nHaotong Qin†\\nETH Zurich\\nhaotong.qin@pbl.ee.ethz.chXingyu Zheng\\nBeihang University\\nxingyuzheng@buaa.edu.cn\\nChengtao Lv\\nBeihang University\\nlvchengtao@buaa.edu.cnHong Chen\\nBeihang University\\n18373205@buaa.edu.cnJie Luo\\nBeihang University\\nluojie@buaa.edu.cn\\nXiaojuan Qi\\nThe University of Hong Kong\\nxjqi@eee.hku.hkXianglong Liu\\nBeihang University\\nxlliu@buaa.edu.cnMichele Magno\\nETH Zurich\\nmichele.magno@pbl.ee.ethz.ch\\nAbstract\\nMeta’s LLAMA family has become one of the most powerful open-source Large\\nLanguage Model (LLM) series. Notably, LLAMA3 models have recently been\\nreleased and achieve impressive performance across various with super-large scale\\npre-training on over 15T tokens of data. Given the wide application of low-\\nbit quantization for LLMs in resource-limited scenarios, we explore LLAMA3 ’s\\ncapabilities when quantized to low bit-width. This exploration holds the potential to\\nunveil new insights and challenges for low-bit quantization of LLAMA3 and other\\nforthcoming LLMs, especially in addressing performance degradation problems\\nthat suffer in LLM compression. Specifically, we evaluate the 10 existing post-\\ntraining quantization and LoRA-finetuning methods of LLAMA3 on 1-8 bits\\nand diverse datasets to comprehensively reveal LLAMA3 ’s low-bit quantization\\nperformance. Our experiment results indicate that LLAMA3 still suffers non-\\nnegligent degradation in these scenarios, especially in ultra-low bit-width. This\\nhighlights the significant performance gap under low bit-width that needs to be\\nbridged in future developments. We expect that this empirical study will prove\\nvaluable in advancing future models, pushing the LLMs to lower bit-width with\\nhigher accuracy for being practical. Our project is released on https://github.\\ncom/Macaronlin/LLaMA3-Quantization and quantized LLAMA3 models are\\nreleased in https://huggingface.co/LLMQ .\\n1 Introduction\\nLaunched by Meta in February 2023, the LLaMA [ 18] series2represents a breakthrough in autore-\\ngressive large language models (LLMs) using the Transformer [ 19] architecture. Right from its first\\n∗Equal Contribution.†Corresponding Author.\\n2https://llama.meta.comarXiv:2404.14047v1  [cs.LG]  22 Apr 2024', metadata={'source': '2404.14047v1.pdf', 'page': 0}), Document(page_content='Evaluated LLMsLLaMA3-8BLLaMA3-70B1QuantizationMethodsRTN2GPTQAWQSmoothQuantPB-LLMBiLLMQuIPDB-LLMQLoRAIR-QLoRAEvaluationDatasetsWikiText2C4PTBPIQAARC-eARC-cHellaSwag3WinograndePerplexity↓CommonSenseQA↑Post-Training QuantizationLoRA-FinetuningHumanitiesSTEMSocialOtherMMLU↑Figure 1: The overview of our empirical study\\nversion, with 13 billion parameters, it managed to outperform the much larger, closed-source GPT-3\\nmodel which boasts 175 billion parameters. On April 18, 2024, Meta introduced the LLAMA3\\nmodel, offering configurations of 8 billion and 70 billion parameters. Thanks to extensive pre-training\\non more than 15 trillion data tokens, the LLAMA3 models3have achieved state-of-the-art (SOTA)\\nperformance across a broad range of tasks, establishing the LLaMA family as among the finest\\nopen-source LLMs available for a wide variety of applications and deployment scenarios.\\nDespite their impressive performance, deploying LLAMA3 models still poses significant challenges\\ndue to resource limitations in many scenarios. Fortunately, low-bit quantization has emerged as one\\nof the most popular techniques for compressing LLMs. This technique reduces the memory and\\ncomputational requirements of LLMs during inference, enabling them to run on resource-limited\\ndevices. Addressing the performance drop that occurs after compression is a major concern for\\ncurrent LLM quantization approaches. While numerous low-bit quantization methods have been\\nproposed, their evaluations have primarily focused on the earlier and less capable LLaMA models\\n(LLAMA1 andLLAMA2 ). Thus, LLAMA3 presents a new opportunity for the LLM community\\nto assess the performance of quantization on cutting-edge LLMs and to understand the strengths\\nand limitations of existing methods. In this empirical study, our aim is to analyze the capability of\\nLLAMA3 to handle the challenges associated with degradation due to quantization.\\nOur study sets out two primary technology tracks for quantizing LLMs: Post-Training Quantization\\n(PTQ) and LoRA-FineTuning (LoRA-FT) quantization, with the aim of providing a comprehensive\\nevaluation of the LLAMA3 models’ quantization. We explore a range of cutting-edge quantization\\nmethods across technical tracks (RTN, GPTQ [ 6], AWQ [ 10], SmoothQuant [ 20], PB-LLM [ 16],\\nQuIP [ 2], DB-LLM [ 3], and BiLLM [ 9] for PTQ; QLoRA [ 5] and IR-QLoRA [ 13] for LoRA-FT),\\ncovering a wide spectrum from 1 to 8 bits and utilizing a diverse array of evaluation datasets, including\\nWikiText2, C4, PTB, CommonSenseQA datasets (PIQA, ARC-e, ARC-c, HellaSwag, Winogrande),\\nand MMLU benchmark. The overview of our study is presented as Figure 1. These evaluations\\nassess the capabilities and limits of the LLAMA3 model under current LLM quantization techniques\\nand serve as a source of inspiration for the design of future LLM quantization methods. The choice\\nto focus specifically on the LLAMA3 model is motivated by its superior performance among all\\ncurrent open-source instruction-tuned LLMs across a variety of datasets3, including 5-shot MMLU,\\n0-shot GPQA, 0-shot HumanEval, 8-shot CoT GSM-8K, and 4-shot CoT MATH. Furthermore, we\\nhave made our project and the quantized models available to the public on https://github.com/\\nMacaronlin/LLaMA3-Quantization andhttps://huggingface.co/LLMQ , respectively. This\\nnot only aids in advancing the research within the LLM quantization community but also facilitates a\\nbroader understanding and application of effective quantization techniques.\\n2 Empirical Evaluation\\n2.1 Experiment Settings\\nEvaluated LLMs. We obtain the pre-trained LLAMA3 -8B and -70B through the official repository3.\\nQuantization methods. To evaluate the performance of low-bit quantized LLAMA3 , we select\\nrepresentative LLM quantization methods with extensive influence and functionality, including 8\\n3https://github.com/meta-llama/llama3\\n2', metadata={'source': '2404.14047v1.pdf', 'page': 1}), Document(page_content='Table 1: Evaluation results of post-training quantization on LL AMA3-8B model\\nMethod #W #A #GPPL↓ CommonSenseQA ↑\\nWikiText2 C4 PTB PIQA ARC-e ARC-c HellaSwag Wino Avg.\\nLLAMA3 16 16 - 6.1 9.2 10.6 79.9 80.1 50.4 60.2 72.8 68.6\\nRTN4 16 128 8.5 13.4 14.5 76.6 70.1 45.0 56.8 71.0 63.9\\n3 16 128 27.9 1.1e2 95.6 62.3 32.1 22.5 29.1 54.7 40.2\\n2 16 128 1.9E3 2.5E4 1.8E4 53.1 24.8 22.1 26.9 53.1 36.0\\n8 16 - 6.2 9.5 11.2 79.7 80.8 50.4 60.1 73.4 68.9\\n4 16 - 8.7 14.0 14.9 75.0 68.2 39.4 56.0 69.0 61.5\\n3 16 - 2.2E3 5.6E2 2.0E3 56.2 31.1 20.0 27.5 53.1 35.6\\n2 16 - 2.7E6 7.4E6 3.1E6 53.1 24.7 21.9 25.6 51.1 35.3\\nGPTQ4 16 128 6.5 10.4 11.0 78.4 78.8 47.7 59.0 72.6 67.3\\n3 16 128 8.2 13.7 15.2 74.9 70.5 37.7 54.3 71.1 61.7\\n2 16 128 2.1E2 4.1E4 9.1E2 53.9 28.8 19.9 27.7 50.5 36.2\\n8 16 - 6.1 9.4 10.6 79.8 80.1 50.2 60.2 72.8 68.6\\n4 16 - 7.0 11.8 14.4 76.8 74.3 42.4 57.4 72.8 64.8\\n3 16 - 13.0 45.9 37.0 60.8 38.8 22.3 41.8 60.9 44.9\\n2 16 - 5.7E4 1.0E5 2.7E5 52.8 25.0 20.5 26.6 49.6 34.9\\nAWQ4 16 128 6.6 9.4 11.1 79.1 79.7 49.3 59.1 74.0 68.2\\n3 16 128 8.2 11.6 13.2 77.7 74.0 43.2 55.1 72.1 64.4\\n2 16 128 1.7E6 2.1E6 1.8E6 52.4 24.2 21.5 25.6 50.7 34.9\\n8 16 - 6.1 8.9 10.6 79.6 80.3 50.5 60.2 72.8 68.7\\n4 16 - 7.1 10.1 11.8 78.3 77.6 48.3 58.6 72.5 67.0\\n3 16 - 12.8 16.8 24.0 71.9 66.7 35.1 50.7 64.7 57.8\\n2 16 - 8.2E5 8.1E5 9.0E5 55.2 25.2 21.3 25.4 50.4 35.5\\nQuIP4 16 - 6.5 11.1 9.5 78.2 78.2 47.4 58.6 73.2 67.1\\n3 16 - 7.5 11.3 12.6 76.8 72.9 41.0 55.4 72.5 63.7\\n2 16 - 85.1 1.3E2 1.8E2 52.9 29.0 21.3 29.2 51.7 36.8\\nDB-LLM 2 16 128 13.6 19.2 23.8 68.9 59.1 28.2 42.1 60.4 51.8\\nPB-LLM2 16 128 24.7 79.2 65.6 57.0 37.8 17.2 29.8 52.5 38.8\\n1.7 16 128 41.8 2.6E2 1.2E2 52.5 31.7 17.5 27.7 50.4 36.0\\nBiLLM 1.1 16 128 28.3 2.9E2 94.7 56.1 36.0 17.7 28.9 51.0 37.9\\nSmoothQuant8 8 - 6.3 9.2 10.8 79.5 79.7 49.0 60.0 73.2 68.3\\n6 6 - 7.7 11.8 12.5 76.8 75.5 45.0 56.9 69.0 64.6\\n4 4 - 4.3E3 4.0E3 3.6E3 54.6 26.3 20.0 26.4 50.3 35.5\\nPTQ methods and 2 LoRA-FT methods. The implementations of our evaluated quantization methods\\nfollow their open-source repositories4. We also used eight NVIDIA A800 with 80GB GPU memory\\nfor quantitative evaluation.\\nEvaluation datasets. For the PTQ methods, we evaluate quantized LLAMA3 on the WikiText2 [ 12],\\nPTB [ 11], and a portion of the C4 dataset [ 14], using Perplexity (PPL) as the evaluation metric.\\nSubsequently, we further conduct experiments on five zero-shot evaluation tasks (PIQA [ 1], Wino-\\ngrande [ 15], ARC-e [ 4], ARC-c [ 4], and Hellaswag [ 22]) to fully validate the quantized performance\\nofLLAMA3 . For the LoRA-FT methods, we conduct the evaluation on the 5-shot MMLU bench-\\nmark [7] while also validating the aforementioned 5 zero-shot datasets for the LoRA-FT methods.\\nFor the fairness of our evaluation, we uniformly use WikiText2 as the calibration dataset for all\\nquantization methods, with a sample size of 128 and a consistent token sequence length of 2048.\\nFurthermore, for quantization methods requiring channel-wise grouping, we adopt a block size of\\n128 to balance performance and inference efficiency, which is a common practice in existing works.\\n4https://github.com/IST-DASLab/gptq ,https://github.com/mit-han-lab/llm-awq ,https:\\n//github.com/mit-han-lab/smoothquant ,https://github.com/Cornell-RelaxML/QuIP ,https:\\n//github.com/hahnyuan/PB-LLM ,https://github.com/Aaronhuang-778/BiLLM ,https://github.\\ncom/artidoro/qlora ,https://github.com/htqin/IR-QLoRA\\n3', metadata={'source': '2404.14047v1.pdf', 'page': 2}), Document(page_content='Table 2: Evaluation results of post-training quantization on LL AMA3-70B model\\nMethod #W #A #GPPL↓ CommonSenseQA ↑\\nWikiText2 C4 PTB PIQA ARC-e ARC-c HellaSwag Wino Avg.\\nLLAMA3 16 16 - 2.9 6.9 8.2 82.4 86.9 60.3 66.4 80.6 75.3\\nRTN4 16 128 3.6 8.9 9.1 82.3 85.2 58.4 65.6 79.8 74.3\\n3 16 128 11.8 22.0 26.3 64.2 48.9 25.1 41.1 60.5 48.0\\n2 16 128 4.6E5 4.7E5 3.8E5 53.2 23.9 22.1 25.8 53.0 35.6\\nGPTQ4 16 128 3.3 6.9 8.3 82.9 86.3 58.4 66.1 80.7 74.9\\n3 16 128 5.2 10.5 9.7 80.6 79.6 52.1 63.5 77.1 70.6\\n2 16 128 11.9 22.8 31.6 62.7 38.9 24.6 41.0 59.9 45.4\\nAWQ4 16 128 3.3 7.0 8.3 82.7 86.3 59.0 65.7 80.9 74.9\\n3 16 128 4.8 8.0 9.0 81.4 84.7 58.0 63.5 78.6 73.2\\n2 16 128 1.7E6 1.4E6 1.5E6 52.2 25.5 23.1 25.6 52.3 35.7\\nQuIP4 16 - 3.4 7.1 8.4 82.5 86.0 58.7 65.7 79.7 74.5\\n3 16 - 4.7 8.0 8.9 82.3 83.3 54.9 63.9 78.4 72.5\\n2 16 - 13.0 22.2 24.9 65.3 48.9 26.5 40.9 61.7 48.7\\nPB-LLM2 16 128 11.6 34.5 27.2 65.2 40.6 25.1 42.7 56.4 46.0\\n1.7 16 128 18.6 65.2 55.9 56.5 49.9 25.8 34.9 53.1 44.1\\nBiLLM 1.1 16 128 17.1 77.7 54.2 58.2 46.4 25.1 37.5 53.6 44.2\\nSmoothQuant8 8 - 2.9 6.9 8.2 82.2 86.9 60.2 66.3 80.7 75.3\\n6 6 - 2.9 6.9 8.2 82.4 87.0 59.9 66.1 80.6 75.2\\n4 4 - 9.6 16.9 17.7 76.9 75.8 43.5 52.9 58.9 61.6\\n2.2 Track1: Post-Training Quantization\\nAs shown in Table 1 and Table 2, we provide the performance of low-bit LLAMA3 -8B and LLAMA3 -\\n70B with 8 different PTQ methods, respectively, covering a wide bit-width spectrum from 1 to 8-bit.\\nAmong them, Round-To-Nearest (RTN) is a vanilla rounding quantization method. GPTQ [ 6] is\\ncurrently one of the most efficient and effective weight-only quantization methods, which utilizes\\nerror compensation in quantization. But under 2-3 bits, GPTQ causes severe accuracy collapse when\\nquantized LLAMA3 . AWQ [ 10] adopts an anomaly channel suppression approach to reduce the\\ndifficulty of weight quantization, and QuIP [ 2] ensures the incoherence between weights and Hessian\\nby optimizing matrix computation. Both of them can keep LLAMA3 ’s capability at 3-bit and even\\npush the 2-bit quantization to promising.\\nThe recent emergence of binarized LLM quantization methods has realized ultra-low bit-width LLM\\nweight compression. PB-LLM [ 16] employs a mixed-precision quantization strategy, retaining a\\nsmall portion of significant weight full-precision while quantizing the majority of weights to 1-bit.\\nDB-LLM [ 3] achieves efficient LLM compression through double binarization weight splitting\\nand proposes a deviation-aware distillation strategy to further enhance 2-bit LLM performance.\\nBiLLM [ 9] further pushes the LLM quantization boundary to as low as 1.1-bit through residual\\napproximation of salient weights and grouped quantization of non-salient weights. These LLM\\nquantization methods specially designed for ultra-low bit-width can achieve higher accuracy of\\nquantized LLAMA3 -8B at⩽2-bit, far outperforms methods like GPTQ, AWQ, and QuIP under\\n2-bit (even 3-bit some cases).\\nWe also perform LLAMA3 evaluation on quantized activations via SmoothQuant [ 20], which moves\\nthe quantization difficulty offline from activations to weights to smooth out activation outliers. Our\\nevaluation shows that SmoothQuant can retain the accuracy of LLAMA3 with 8- and 6-bit weights\\nand activations, but faces collapse at 4-bit.\\nMoreover, we find that the LLAMA3 -70B model shows significant robustness for various quantization\\nmethods, even in ultra-low bit-width.\\n4', metadata={'source': '2404.14047v1.pdf', 'page': 3}), Document(page_content='Table 3: LoRA-FT on LL AMA3-8B with Alpaca dataset\\nMethod #WMMLU ↑ CommonSenseQA ↑\\nHums. STEM Social Other Avg. PIQA ARC-e ARC-c HellaSwag Wino Avg.\\nLLAMA3 16 59.0 55.3 76.0 71.5 64.8 79.9 80.1 50.4 60.2 72.8 68.6\\nNormalFloat 4 56.8 52.9 73.6 69.4 62.5 78.6 78.5 46.2 58.8 74.3 67.3\\nQLoRA 4 50.3 49.3 65.8 64.2 56.7 76.6 74.8 45.0 59.4 67.0 64.5\\nIR-QLoRA 4 52.2 49.0 66.5 63.1 57.2 76.3 74.3 45.3 59.1 69.5 64.9\\n2.3 Track2: LoRA-FineTuning Quantization\\nExcept for the PTQ methods, we also provide the performance of 4-bit LLAMA3 -8B with 2 different\\nLoRA-FT quantization methods as shown in Table 3, including QLoRA [5] and IR-QLoRA [13].\\nOn the MMLU dataset, the most notable observation with LLAMA3 -8B under LoRA-FT quantization\\nis that low-rank finetuning on the Alpaca [ 17] dataset not only cannot compensate for the errors\\nintroduced by quantization, even making the degradation more severe. Specifically, various LoRA-FT\\nquantization methods obtain worse performance quantized LLAMA3 under 4-bit compared with their\\n4-bit counterparts without LoRA-FT. This is in stark contrast to similar phenomena on LLAMA1\\nandLLAMA2 , where, for the front one, the 4-bit low-rank finetuned quantized versions could\\neven easily surpass the original FP16 counterpart on MMLU. According to our intuitive analysis,\\nthe main reason for this phenomenon is due to LLAMA3 ’s strong performance brought by its\\nmassive pre-scale training, which means the performance loss from the original model’s quantization\\ncannot be compensated for by finetuning on a tiny set of data with low-rank parameters (which can\\nbe seen as a subset of the original model [ 8,5]). Despite the significant drop from quantization\\nthat cannot be compensated by finetuning, 4-bit LoRA-FT quantized LLAMA3 -8B significantly\\noutperforms LLAMA1 -7B and LLAMA2 -7B under various quantization methods. For instance, with\\nthe QLoRA method, 4-bit LLAMA3 -8B has an average accuracy of 57.0 (FP16: 64.8), exceeding\\n4-bit LLAMA1 -7B’s 38.4 (FP16: 34.6) by 18.6, and surpassing 4-bit LLAMA2 -7B’s 43.9 (FP16:\\n45.5) by 13.1 [ 21,13]. This implies that a new LoRA-FT quantization paradigm is needed in the era\\nof LL AMA3.\\nA similar phenomenon occurs with the CommonSenseQA benchmark. Compared to the 4-bit\\ncounterparts without LoRA-FT, the performance of the models fine-tuned using QLoRA and IR-\\nQLoRA also declined ( e.g.QLoRA 2.8% vs IR-QLoRA 2.4% on average). This further demonstrates\\nthe strength of using high-quality datasets in LLAMA3 , as the general dataset Alpaca does not\\ncontribute to the model’s performance in other tasks.\\n3 Conclusion\\nMeta’s recently released LLAMA3 models have rapidly become the most powerful LLM series, cap-\\nturing significant interest from researchers. Building on this momentum, our study aims to thoroughly\\nevaluate the performance of LLAMA3 across a variety of low-bit quantization techniques, including\\npost-training quantization and LoRA-finetuning quantization. Our goal is to assess the boundaries\\nof its capabilities in scenarios with limited resources by leveraging existing LLM quantization tech-\\nnologies. Our findings indicate that while LLAMA3 still demonstrates superior performance after\\nquantization, the performance degradation associated with quantization is significant and can even\\nlead to larger declines in many cases. This discovery highlights the potential challenges of deploying\\nLLAMA3 in resource-constrained environments and underscores the ample room for growth and\\nimprovement within the context of low-bit quantization. The empirical insights from our research are\\nexpected to be valuable for the development of future LLM quantization techniques, especially in\\nterms of narrowing the performance gap with the original models. By addressing the performance\\ndegradation caused by low-bit quantization, we anticipate that subsequent quantization paradigms\\nwill enable LLMs to achieve stronger capabilities at a lower computational cost, ultimately driving', metadata={'source': '2404.14047v1.pdf', 'page': 4}), Document(page_content='degradation caused by low-bit quantization, we anticipate that subsequent quantization paradigms\\nwill enable LLMs to achieve stronger capabilities at a lower computational cost, ultimately driving\\nthe progress of generative artificial intelligence, as represented by LLMs, to new heights.\\n5', metadata={'source': '2404.14047v1.pdf', 'page': 4}), Document(page_content='References\\n[1]Yonatan Bisk, Rowan Zellers, Jianfeng Gao, Yejin Choi, et al. Piqa: Reasoning about phys-\\nical commonsense in natural language. In Proceedings of the AAAI conference on artificial\\nintelligence , volume 34, pages 7432–7439, 2020.\\n[2]Jerry Chee, Yaohui Cai, V olodymyr Kuleshov, and Christopher M De Sa. Quip: 2-bit quantiza-\\ntion of large language models with guarantees. Advances in Neural Information Processing\\nSystems , 36, 2024.\\n[3]Hong Chen, Chengtao Lv, Liang Ding, Haotong Qin, Xiabin Zhou, Yifu Ding, Xuebo Liu, Min\\nZhang, Jinyang Guo, Xianglong Liu, et al. Db-llm: Accurate dual-binarization for efficient llms.\\narXiv preprint arXiv:2402.11960 , 2024.\\n[4]Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick,\\nand Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning\\nchallenge. arXiv preprint arXiv:1803.05457 , 2018.\\n[5]Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient\\nfinetuning of quantized llms. Advances in Neural Information Processing Systems , 36, 2024.\\n[6]Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. Gptq: Accurate post-training\\nquantization for generative pre-trained transformers. arXiv preprint arXiv:2210.17323 , 2022.\\n[7]Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and\\nJacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint\\narXiv:2009.03300 , 2020.\\n[8]Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu\\nChen, et al. Lora: Low-rank adaptation of large language models. In International Conference\\non Learning Representations , 2021.\\n[9]Wei Huang, Yangdong Liu, Haotong Qin, Ying Li, Shiming Zhang, Xianglong Liu, Michele\\nMagno, and Xiaojuan Qi. Billm: Pushing the limit of post-training quantization for llms. arXiv\\npreprint arXiv:2402.04291 , 2024.\\n[10] Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Xingyu Dang, and Song Han. Awq:\\nActivation-aware weight quantization for llm compression and acceleration. arXiv preprint\\narXiv:2306.00978 , 2023.\\n[11] Mitch Marcus, Grace Kim, Mary Ann Marcinkiewicz, Robert MacIntyre, Ann Bies, Mark\\nFerguson, Karen Katz, and Britta Schasberger. The penn treebank: Annotating predicate\\nargument structure. In Human Language Technology: Proceedings of a Workshop held at\\nPlainsboro, New Jersey, March 8-11, 1994 , 1994.\\n[12] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture\\nmodels. arXiv preprint arXiv:1609.07843 , 2016.\\n[13] Haotong Qin, Xudong Ma, Xingyu Zheng, Xiaoyang Li, Yang Zhang, Shouda Liu, Jie Luo, Xi-\\nanglong Liu, and Michele Magno. Accurate lora-finetuning quantization of llms via information\\nretention. arXiv preprint arXiv:2402.05445 , 2024.\\n[14] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena,\\nYanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified\\ntext-to-text transformer. The Journal of Machine Learning Research , 21(1):5485–5551, 2020.\\n[15] Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An\\nadversarial winograd schema challenge at scale. Communications of the ACM , 64(9):99–106,\\n2021.\\n[16] Yuzhang Shang, Zhihang Yuan, Qiang Wu, and Zhen Dong. Pb-llm: Partially binarized large\\nlanguage models. arXiv preprint arXiv:2310.00034 , 2023.\\n6', metadata={'source': '2404.14047v1.pdf', 'page': 5}), Document(page_content='[17] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy\\nLiang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model.\\nhttps://github.com/tatsu-lab/stanford_alpaca , 2023.\\n[18] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timo-\\nthée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open\\nand efficient foundation language models. arXiv preprint arXiv:2302.13971 , 2023.\\n[19] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez,\\nŁukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information\\nprocessing systems , 30, 2017.\\n[20] Guangxuan Xiao, Ji Lin, Mickael Seznec, Hao Wu, Julien Demouth, and Song Han.\\nSmoothquant: Accurate and efficient post-training quantization for large language models.\\nInInternational Conference on Machine Learning , pages 38087–38099. PMLR, 2023.\\n[21] Yuhui Xu, Lingxi Xie, Xiaotao Gu, Xin Chen, Heng Chang, Hengheng Zhang, Zhensu Chen,\\nXiaopeng Zhang, and Qi Tian. Qa-lora: Quantization-aware low-rank adaptation of large\\nlanguage models. arXiv preprint arXiv:2309.14717 , 2023.\\n[22] Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a\\nmachine really finish your sentence? arXiv preprint arXiv:1905.07830 , 2019.\\n7', metadata={'source': '2404.14047v1.pdf', 'page': 6})]\n"
     ]
    }
   ],
   "source": [
    "from langchain_community.document_loaders import PyPDFLoader\n",
    "loader = PyPDFLoader(\"2404.14047v1.pdf\")\n",
    "pages = loader.load_and_split()\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3. Website Loader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Document(page_content='\\n\\n\\n\\n\\n\\n\\n\\n\\nUnveiling YouTube Insights - Introduction, Data Collection, Data Processing, and Database (Part 1) • Supertype\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nSkip to content\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\n \\nSupertype\\nProduct & Services\\n\\nPortfolio Computer Vision Custom BI Development Managed Data Analytics & Development Programmatic Report Generation\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nAnalytics Products & Services \\nData analytics and data engineering services\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n\\nBusiness Intelligence & Analytics Dashboard\\nWe design and develop custom web dashboards that integrate your data sources, presented in your custom style / branding\\n\\n\\n\\n\\n\\n\\n\\n\\nComputer Vision Research & Development\\nFrom flood detection in crop management, to facial recognition and object classification, using the latest in deep learning and AI research\\n\\n\\n\\n\\n\\n\\n\\n\\nPDF Generation as a Service\\nSupertype Summary creates a highly tailored pipeline that output bespoke PDF in seconds, not days or hours\\n\\n\\n\\n                                hot\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n\\n\\n\\nManaged Analytics Services & Development\\nBeyond analytics consulting, we can take on the full lifecycle of your data science and analytics project\\n\\n\\n\\n\\n\\n\\n\\n\\nLLM Development Service\\nBuild on OpenAI\\'s language models and open source LLM tooling such as LangChain and LlamaIndex\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\nData Science by Applications \\nImplementations of data science in various industries\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n\\nData Science for e-Commerce\\nWeb analytics, recommender systems, media buying, and price scraping / monitoring\\n\\n\\n\\n\\n\\n\\n\\n\\nData Science for Mobile Apps & Games\\nARPU optimization, in-app analytics, user acquisition tracking and analytics\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nBespoke solution for enterprises\\n\\t\\t\\t\\t\\t\\tAdvisory & Consulting\\n\\t\\t\\t\\t\\t \\n\\n\\n\\n \\n\\n\\n\\n\\nData Science Consulting Services\\nData Science Consulting for companies that require effective, result-driven advisory on their data analytics process\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\nPortfolio & highlights \\nCuration of featured projects and enterprise work\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n\\nProject gallery\\nOur data science portfolio and past projects in a gallery view\\n\\n\\n\\n\\n\\n\\n\\n\\nSupertype Incubator\\nSupertype Incubator is a platform for data scientists and engineers to develop real-world projects sponsored and supported by Supertype\\n\\n\\n\\n                                new\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n\\n\\n\\nEnterprise Data Science | Case Studies\\nLearn how we help companies like yours take charge of their analytics initiatives and build winning systems\\n\\n\\n\\n\\n\\n\\n\\n\\nArticles\\nField notes and observations by data scientists and engineers on the team\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nArticles \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\t\\t\\t\\t\\t\\tData Engineering\\n\\t\\t\\t\\t\\t \\nTechnical articles by data engineers & automation developers solving real-world problems\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n\\nThe Essential Guide to Docker\\n\\n\\n\\n\\n\\n\\n\\n\\nSetting up Docker Compose v2\\n\\n\\n\\n\\n\\n\\n\\n\\nIntroduction to Apache Airflow\\n\\n\\n\\n\\n\\n\\n\\n\\nDjango REST framework + Custom Permissions\\n\\n\\n\\n\\n\\n\\n\\n\\nDeploying Machine Learning models with VertexAI on Google Cloud Platform\\n\\n\\n\\n\\n\\n\\n\\n\\nStreaming Data Pipeline: The Full Cycle\\u200b\\n4-part series on building a real-time Streamlit analytics app powered by Kafka, Spark Streaming, Cassandra and MySQL\\n\\n\\n\\n                                new\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n\\n\\n\\nSee More\\n\\n\\n\\n                                20+\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\t\\t\\t\\t\\t\\tData Science\\n\\t\\t\\t\\t\\t \\nArticles and first hand observations by data scientists & analytics experts in the field\\n\\n \\n\\n\\n\\n \\n\\n\\n\\n\\nData Science for App Reviews Analysis\\n\\n\\n\\n\\n\\n\\n\\n\\nAutomated Keywords Extractions from job descriptions\\n\\n\\n\\n\\n\\n\\n\\n\\nServing PyTorch Models with TorchServe\\n\\n\\n\\n\\n\\n\\n\\n\\nIntroduction to RFM analysis in R\\n\\n\\n\\n\\n\\n\\n\\n\\nDecision Boundaries with PCA and FAMD\\n\\n\\n\\n\\n\\n\\n\\n\\nRiver Water Level Monitoring w/ Google Data Studio\\n\\n\\n\\n\\n\\n\\n\\n\\nTwitter Sentiment Analysis End to End\\n4-part series on building and deploying a deep learning LSTM model for tweets sentiment scoring\\n\\n\\n\\n                                new\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n\\n\\n\\nBuilding a GPT-3 app with LangChain, Django, and YouTube API\\nA detailed walkthrough of building an AI web application powered by LangChain LLM toolkit and Django\\n\\n\\n\\n                                new\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\nFull-Cycle Data Science Consultancy\\n\\t\\t\\t\\t\\t\\tData Science & Analytics Consulting\\n\\t\\t\\t\\t\\t \\n\\n\\n\\n \\n\\n\\n\\n\\nCase Study: Central Bank of Indonesia\\nA scalable query-able API service and data archive of public opinion towards monetary policies across 100+ social media channels ft. data engineering, web automation and sentiment analysis\\n\\n\\n\\n\\n\\n\\n\\n\\nCase Study: Adaro Water Level Prediction\\nDevelop an end-to-end analytical infrastructure to facilitate real-time analytics, storage & water level prediction a 1,090km river in Kalimantan ft. deep learning, data engineering & analytics engineering\\n\\n\\n\\n\\n\\n\\n\\n\\nCase Study: Adaro Predictive Maintenance \\nHow Supertype & PT. Saptaindra Sejati (Adaro) built a comprehensive predictive maintenance system that shaves millions off maintenance cost each year\\n\\n\\n\\n                                new\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n\\n\\n\\nCase Study: AdColony (Opera)\\nTaking advertising operations and monetisation to the next level using a range of machine learning techniques, ft. unsupervised learning, deep learning\\n\\n\\n\\n\\n\\n\\n\\n\\nCase Study: Creadits\\nSupertype\\'s data scientists and Creadits combined to produce advertising creatives that are 40% more performant, powered by deep insights into ad creatives\\' lifespan, ft. Supertype Summary, unsupervised learning\\n\\n\\n\\n\\n\\n\\n\\n\\nCase Study: Programmatic Media Buying\\nProgrammatic audience creation through a bespoke machine-learning-as-an-API service, so media buying on RTB (real-time buying) exchanges are timely and with a stream of pre-qualified audience.\\n\\n\\n\\n\\n\\n\\n\\n\\nMore Data Science Consulting Case Studies\\n\\n\\n\\n                                new\\t\\t\\t\\t\\t\\t    \\n\\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nAbout\\nContact\\n\\n\\n\\n\\n\\n\\n\\nX\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\nUnveiling YouTube Insights – Introduction, Data Collection, Data Processing, and Database (Part 1) \\nLeave a Comment \\r\\n\\r\\n\\t\\t\\t / notes, knowledge / By  \\nGeraldus Wilsen\\n\\n\\n \\n\\n\\nUnveiling YouTube Insights – Introduction, Data Collection, Data Processing, and Database (Part 1)\\n\\nIntroduction\\nWe, as programmers, are witnessing the rise of the Large Language Model (LLM) as the latest trend. Data scientists, software engineers, and even website or mobile developers are all captivated by its potential. When we can seamlessly integrate LLM into our products, it becomes a truly exciting prospect. Now, you might wonder, “How can we achieve this?” or “Isn’t building AI products costly?” Well, let me assure you, it’s a resounding “NO”! After reading this article, we’ll discover how we can create our very own AI app for free and with utmost ease. Let’s dive in!\\nFor this first project, we will be utilizing data from YouTube. Now, for a second, I want us to positioning ourself as a YouTube creator. Nowadays we can track metrics like views, watch time, audience demographics, traffic sources, and more in ease through YouTube studio. However, to grow our YouTube channel we need to know what people say about our content through their comment, right? What’s their feedback, what they like from our video, and many more. On the other hand, right now Youtube Studio hasn’t provided a tool to summarize those comment, if we only have 50 comments in our content, we can read it one by one. But how if our channel keeps growing, you upload more than 3 videos each week and more than 100 comments we will receive everyday. If we keep analyzing manually, we’ll waste our valuable time.\\nThat’s why today our mission is to help every Youtube content creator out there to easily analyzing their comment and gain insight from it in a minute using help of Large Language Model. Speaking of YouTube data, I highly recommend you checking out an article on data engineering authored by my colleague, Timotius. This series delves into data engineering using Airflow, offering valuable insights into the subject.\\nWorkflow and Pre-requisites\\nOkay, let’s get back to the topic! Before we start, I want to explain briefly how’s our website work\\n\\nUser input a link of a YouTube video – part 1\\nScrap the statistic and comment – part 1\\nStore it to database – part 1\\nUser can start a conversation with AI bot ( build with Langchain and Hugging Face Open Source Model) – part 2\\n\\nIn this article, I will more focus explaining about the backend side explaining on how it’s working. Mainly using Django, Django REST Framework, and Langchain. If you haven’t known it yet, I really recommend you to watch this video before continue:\\n\\nLangchain: LangChain & LLM tutorials (ft. gpt3, chatgpt, llamaindex, chroma) by Samuel Chan\\nDjango: Django Crash Course – Introduction + Python Web Development Tutorial by Caleb Curry\\nDjango REST Framework: Django REST Framework – Build an API from Scratch by Caleb Curry\\n\\nFor the frontend part, we are going to use Tailwind CSS, HTML, and JavaScript. Please feel free to check out my GitHub repository. I encourage you to explore and develop it further with your own design style, as I’m sure the talented audience reading this article can enhance it in amazing ways. If you are ready, let’s start with the first part, which focuses on data collection, data processing, and database\\nData Collection, Data Processing, and Database\\nIf you still remember the workflow of our website, the first step is to submit a YouTube video link. Using this link, we will perform a scraping task, which involves the process of data collection. Scraping YouTube data is relatively straightforward; what we actually need is a YouTube API key. Our team at Supertype has provided you with a quick tutorial, which you can access here:\\n\\nPart 1: YouTube Analytics API with Python (May 2022 new Google API Library)\\nPart 2: YouTube Comments to CSV\\nGithub Repo: youtube_api_python\\n\\nIn this section, we will modify some parts of the code to meet our specific requirements.\\n\\nCreate a new project in Google Cloud Console\\n\\nGo to Google Cloud Console\\nClick “Select a Project” dropdown beside the Google Cloud icon in the top right of your screen\\nClick “New Project” and fill the form with the project name and location\\n\\nClick the “create” button\\n\\n\\nCreate a YouTube API Key\\n\\nGo to https://console.cloud.google.com/apis/library/youtube.googleapis.com\\nClick “Enable”\\nClick “Create Credentials” and choose “API Key”.\\n\\nOnce you click it, you will get a pop up. This is your secret API Key, copy and save it to an environment variable or .env file so it will not leak.\\n\\n\\nWrite a function to scrap video statistic\\nasync def video_stats(youtube, videoIDs, channelID = None, to_csv=False):\\n    if type(videoIDs) == str:\\n        videoIDs = [videoIDs]\\n\\n    stats_list = []\\n\\n    for videoId in videoIDs:\\n        request = youtube.videos().list(\\n            part=\"snippet, statistics, contentDetails\",\\n            id=videoId\\n        )\\n        response = request.execute()\\n        statistics = response[\\'items\\'][0][\\'statistics\\']\\n        snippet = response[\\'items\\'][0][\\'snippet\\']\\n        statistics[\\'videoId\\'] = videoId\\n        statistics[\\'title\\'] = snippet[\\'title\\']\\n        statistics[\\'description\\'] = snippet[\\'description\\']\\n        statistics[\\'publishedAt\\'] = snippet[\\'publishedAt\\']\\n        statistics[\\'duration\\'] = response[\\'items\\'][0][\\'contentDetails\\'][\\'duration\\']\\n        statistics[\\'thumbnail\\'] = snippet[\\'thumbnails\\'][\\'high\\'][\\'url\\']\\n        statistics[\\'channelId\\'] = channelID\\n        statistics[\\'likeCount\\'] = statistics.get(\\'likeCount\\', 0)\\n\\n        print(f\"Fetched stats for {videoId}\")\\n        stats_list.append(statistics)\\n\\n    return statistics\\nLet’s walk through the code section by section to gain a better understanding of the implementation.\\nasync def video_stats(youtube, videoIDs, channelID=None, to_csv=False):\\nThis line defines an asynchronous function called video_stats. It takes four arguments: youtube (presumably an object representing the YouTube API client), videoIDs (a list of video IDs or a single video ID as a string), channelID (an optional channel ID, defaulting to None), and to_csv (an optional argument, defaulting to False).\\nif type(videoIDs) == str:\\n    videoIDs = [videoIDs]\\nThis checks if the videoIDs is a string. If it is, it converts it into a list containing just that string. This step ensures that the videoIDs parameter can be treated as a list, regardless of whether it was passed as a single string or a list of strings.\\nstats_list = []\\nThis initializes an empty list called stats_list, which will be used to store the statistics data for each video.\\nfor videoId in videoIDs:\\n    request = youtube.videos().list(\\n        part=\"snippet, statistics, contentDetails\",\\n        id=videoId\\n    )\\n    response = request.execute()\\nThis starts a loop that iterates through each videoId in the videoIDs list. Within the loop, it creates a request to the YouTube API to get video details (snippet, statistics, and contentDetails) for the current videoId. The request is executed using request.execute() which sends the request to the YouTube API and gets the response.\\nstatistics = response[\\'items\\'][0][\\'statistics\\']\\nsnippet = response[\\'items\\'][0][\\'snippet\\']\\nThese lines extract the ‘statistics’ and ‘snippet’ information from the API response for the current video.\\nstatistics[\\'videoId\\'] = videoId\\nstatistics[\\'title\\'] = snippet[\\'title\\']\\nstatistics[\\'description\\'] = snippet[\\'description\\']\\nstatistics[\\'publishedAt\\'] = snippet[\\'publishedAt\\']\\nstatistics[\\'duration\\'] = response[\\'items\\'][0][\\'contentDetails\\'][\\'duration\\']\\nstatistics[\\'thumbnail\\'] = snippet[\\'thumbnails\\'][\\'high\\'][\\'url\\']\\nstatistics[\\'channelId\\'] = channelID\\nstatistics[\\'likeCount\\'] = statistics.get(\\'likeCount\\', 0)\\nHere, specific data from the API response is extracted and added to the statistics dictionary for the current video. videoId, title, description, publishedAt, duration, thumbnail, and channelId are taken from the snippet information. likeCount is extracted from the ‘statistics’ dictionary, and if it is not present, it defaults to 0 using the .get() method.\\nprint(f\"Fetched stats for {videoId}\")\\nstats_list.append(statistics)\\nreturn stat_list\\nThis line prints a message indicating that the statistics for the current video with videoId have been fetched. Then, the statistics dictionary for the current video is appended to the stats_list, which collects data for all videos and being returned\\nWrite a function to process comment of the video\\ndef process_comments(response_items, channelID = None, csv_output=False):\\n    comments = []\\n\\n    for res in response_items:\\n\\n        # loop through the replies\\n        if \\'replies\\' in res.keys():\\n            for reply in res[\\'replies\\'][\\'comments\\']:\\n                comment = reply[\\'snippet\\']\\n                comment[\\'commentId\\'] = reply[\\'id\\']\\n                comments.append(comment)\\n        else:\\n            comment = {}\\n            comment[\\'snippet\\'] = res[\\'snippet\\'][\\'topLevelComment\\'][\\'snippet\\']\\n            comment[\\'snippet\\'][\\'parentId\\'] = None\\n            comment[\\'snippet\\'][\\'commentId\\'] = res[\\'snippet\\'][\\'topLevelComment\\'][\\'id\\']\\n\\n            comments.append(comment[\\'snippet\\'])\\n\\n    keytoremove = [\\'textDisplay\\',\\'authorProfileImageUrl\\',\\'authorChannelUrl\\',\\'authorChannelId\\',\\'canRate\\',\\'viewerRating\\',\\'likeCount\\',\\'updatedAt\\',\\'parentId\\']\\n    for i in comments:\\n        for y in keytoremove:\\n            del i[y]\\n\\n    new_comments = []\\n    for original_dict in comments:\\n        new_dict = {\\n            \\'video_id\\': original_dict[\\'videoId\\'],\\n            \\'comment_id\\': original_dict[\\'commentId\\'],\\n            \\'date\\': original_dict[\\'publishedAt\\'],\\n            \\'author\\': original_dict[\\'authorDisplayName\\'],\\n            \\'comment_text\\': original_dict[\\'textOriginal\\']\\n        }\\n        new_comments.append(new_dict)\\n\\n    new_key = \\'channel_id\\'\\n    new_value = channelID\\n\\n    for dictionary in new_comments:\\n        new_dict = {new_key: new_value}\\n        new_dict.update(dictionary)\\n        dictionary.clear()\\n        dictionary.update(new_dict)\\n\\n    def sentiment(i):\\n        blob = TextBlob(i)\\n        score = blob.sentiment.polarity\\n        if score == 0:\\n            sentiment = \\'neutral\\'\\n        elif score > 0: \\n            sentiment = \\'positive\\'\\n        else:\\n            sentiment = \\'negative\\'\\n\\n        return sentiment\\n\\n    for comment in new_comments:\\n        if type(comment[\\'comment_text\\']) == \\'float\\':\\n            comment[\\'sentiment\\'] == \\'no sentiment for numerical values\\'\\n        else:\\n            comment[\\'sentiment\\'] = sentiment(comment[\\'comment_text\\'])\\n\\n    print(f\\'Finished processing {len(new_comments)} comments.\\')\\n    return new_comments\\nThis function takes three parameters:\\n\\nresponse_items: A list of YouTube API response items containing comments data.\\nchannelID (optional): An identifier for the YouTube channel associated with the comments.\\ncsv_output (optional): A boolean flag indicating whether the comments should be saved to a CSV file.\\n\\nThe function performs the following tasks:\\n\\nIt processes the input response_items list to extract relevant information from the comments and replies.\\nIt removes unnecessary keys from the comment data using the keytoremove list.\\nIt constructs a new list of comments in a specific format, containing attributes like video ID, comment ID, date, author, and comment text.\\nIt calculates the sentiment of each comment text using the TextBlob library. sentiment(i): This is a nested function within the process_comments function. It takes a string i as input and calculates the sentiment of the text using TextBlob. The sentiment is categorized as “positive,” “negative,” or “neutral” based on the polarity score of the text.\\nIt prints the number of processed comments.\\nIt returns the processed comments as a list of dictionaries.\\n\\n\\nWrite a function to scrap comment of the video\\nIn this function, we will also use process_comment function that has been defined before.\\nscraped_videos = {}\\n\\nasync def comment_threads(youtube, videoID, channelID=None, to_csv=False):\\n\\n    comments_list = []\\n\\n    try:\\n        request = youtube.commentThreads().list(\\n            part=\\'id,replies,snippet\\',\\n            videoId=videoID,\\n        )\\n        response = request.execute()\\n    except Exception as e:\\n        print(f\\'Error fetching comments for {videoID} - error: {e}\\')\\n        if scraped_videos.get(\\'error_ids\\', None):\\n            scraped_videos[\\'error_ids\\'].append(videoID)\\n        else:\\n            scraped_videos[\\'error_ids\\'] = [videoID]\\n        return\\n\\n    comments_list.extend(process_comments(response[\\'items\\'],channelID))\\n\\n    # if there is nextPageToken, then keep calling the API\\n    while response.get(\\'nextPageToken\\', None):\\n        request = youtube.commentThreads().list(\\n            part=\\'id,replies,snippet\\',\\n            videoId=videoID,\\n            pageToken=response[\\'nextPageToken\\']\\n        )\\n        response = request.execute()\\n        comments_list.extend(process_comments(response[\\'items\\'],channelID)) \\n\\n    print(f\"Finished fetching comments for {videoID}. {len(comments_list)} comments found.\")\\n\\n    if scraped_videos.get(channelID, None):\\n        scraped_videos[channelID].append(videoID)\\n    else:\\n        scraped_videos[channelID] = [videoID]\\n\\n    comment_df = pd.DataFrame(comments_list)\\n\\n    return comment_df\\n\\nThis is an asynchronous function used to fetch comments for a specific YouTube video and process them using the process_comments function. It takes the following parameters:\\n\\nyoutube: The YouTube API client used to make requests.\\nvideoID: The ID of the YouTube video for which comments need to be fetched.\\nchannelID (optional): An identifier for the YouTube channel associated with the video.\\nto_csv (optional): A boolean flag indicating whether the comments should be saved to a CSV file.\\n\\nThe function performs the following tasks:\\n\\nIt makes an API request to fetch the comment threads for the given videoID.\\nIt processes the retrieved comments using the process_comments function.\\nIf there are more comments available (i.e., additional pages), it continues fetching them until there are no more comments.\\nIt prints the number of fetched comments and stores the list of video IDs with their associated channel IDs in the scraped_videos dictionary.\\nIt returns a pandas DataFrame containing the processed comments.\\n\\nPlease note that for the code to work, it requires the necessary libraries, such as pandas and TextBlob, and a YouTube API client initialized with the required credentials. Additionally, the TextBlob class needs to be imported from the textblob library at the beginning of the code.\\nWrite a function to summarize positive and negative comments\\nIn this part, we will not be developing a model from scratch to summarize a text; instead, we will utilize an open-source model from Hugging Face. This approach is entirely free; however, it is important to be aware that there are limitations on the free plan. Therefore, I will present three different ways to summarize the text, along with the pros and cons of each method. But before we proceed, let’s set up the Hugging Face model. Please ensure that you have installed langchain and Hugging Face libraries.\\nFor this case, I have chosen to use the Falcon 7B instruct model, which is one of the best open-source models available in those parameters. The results it provides are quite good. However, if you desire even better results, you may consider trying the OpenAI model or using higher parameters such as the Falcon 40B instruct model or llama2 (though, be mindful that you need to have compatible resources for these higher-parameter models).\\nfrom langchain import HuggingFaceHub\\nfrom langchain.text_splitter import RecursiveCharacterTextSplitter\\nfrom langchain.chains.summarize import load_summarize_chain\\nfrom langchain import PromptTemplate,  LLMChain\\nimport textwrap\\nfrom transformers import pipeline\\n\\nload_dotenv(find_dotenv())\\nHUGGINGFACEHUB_API_TOKEN = os.environ[\"huggingfacehub_api_token\"]\\n\\nrepo_id = \"tiiuae/falcon-7b-instruct\"  \\nfalcon_llm = HuggingFaceHub(\\n    repo_id=repo_id, model_kwargs={\"temperature\": 0.5, \"max_new_tokens\": 425}\\n)\\n\\nUsing load_summarize_chain from Langchain\\nasync def summary_of_comments(df,things = \\'positive\\'):\\n    filtered_comment = df[df[\\'sentiment\\'] == things]\\n    comment_text = \\';\\'.join(filtered_comment[\\'comment_text\\']).replace(\\'n\\',\\'\\')\\n\\n    text_splitter = RecursiveCharacterTextSplitter(chunk_size=500)\\n    comment_doc = text_splitter.create_documents([comment_text])\\n\\n    chain = load_summarize_chain(falcon_llm, chain_type=\"map_reduce\", verbose=True)\\n    print(chain.llm_chain.prompt.template)\\n    print(chain.combine_document_chain.llm_chain.prompt.template)\\n\\n    output_summary = chain.run(comment_doc)\\n    wrapped_text = textwrap.fill(\\n        output_summary, width=100, break_long_words=False, replace_whitespace=False\\n    )\\n    print(wrapped_text)\\n\\n    return wrapped_text\\nIn short, this code will separate the text into chunks. We need to split it since there’s a limit on the number of tokens that can be processed at the same time. Once we split it into chunks, we save it as a document using comment_doc = text_splitter.create_documents([comment_text]). Then, we use load_summarize_chain to summarize the text.\\nUsing this approach, you will get a very comprehensive summary that doesn’t lose the context. However, if your text is too long, this method will incur significant costs in terms of both money and time. If you don’t have compatible resources, your website may end up crashing or encountering errors due to the processing time.\\nUsing combination of Langchain and Question Answering model\\nWe have reviewed the drawbacks of the previous method. Now, let’s explore an alternative solution that could potentially address the cost and time consumption issues. Instead of sending the entire text to the Langchain and Falcon 7B model, we can leverage a question-answering model to identify key points from each text. For this purpose, we are utilizing the prompt, “What {things} things does the user/audience feel?” However, it’s essential to keep in mind that this prompt can be modified in the future to potentially achieve better results.\\nOnce we have extracted the key points using the question-answering model, we can pass them to our Langchain model for summarization.\\nThis approach significantly reduces both cost and processing time. However, it’s worth noting that the results may not always be as satisfactory compared to the first method, where the Falcon 7B instruct model was applied directly to the entire text.\\nThe choice between these two methods depends on your specific requirements. If you need highly accurate and satisfying results, particularly for production or when selling it as a product where customer satisfaction is crucial, you might opt for the first method or consider investing more to achieve better results. On the other hand, if you are looking for a more cost-effective and time-efficient solution and the results do not have to be perfect, the second method could be a suitable option. It strikes a balance between cost and accuracy and may suffice for certain use cases.\\nrm = \\'deepset/roberta-base-squad2\\'\\n\\nquestion_answerer = pipeline(\"question-answering\", model=rm)\\n\\nasync def summary_of_comments(df,things = \\'positive\\'):\\n\\n    print(f\"start summary of {things} comments\")\\n\\n    filtered_comment = df[df[\\'sentiment\\'] == things]\\n\\n    if len(filtered_comment) != 0:\\n\\n        comment_text = \\';\\'.join(filtered_comment[\\'comment_text\\']).replace(\\'n\\',\\'\\')\\n\\n        text_splitter = RecursiveCharacterTextSplitter(chunk_size=500)\\n        comment_doc = text_splitter.create_documents([comment_text])\\n\\n        output = {}\\n        for i in comment_doc:\\n            result = question_answerer(question= f\"What {things} things does the user/audience feel?\", context= i.page_content) #str(i)\\n            output[result[\\'answer\\']] = round(result[\\'score\\'], 4)\\n            print(f\"Answer: \\'{result[\\'answer\\']}\\', score: {round(result[\\'score\\'], 4)}, start: {result[\\'start\\']}, end: {result[\\'end\\']}\")\\n\\n        keys_set = set(output.keys())\\n        keys_sentence = \\'; \\'.join([key for key in keys_set])\\n        print(keys_sentence)\\n\\n        docs = text_splitter.create_documents([keys_sentence])\\n        print(\\'done splitting\\')\\n\\n        chain = load_summarize_chain(falcon_llm, chain_type=\"map_reduce\", verbose=True)\\n        print(chain.llm_chain.prompt.template)\\n        print(chain.combine_document_chain.llm_chain.prompt.template)\\n\\n        output_summary = chain.run(docs)\\n        wrapped_text = textwrap.fill(\\n            output_summary, width=100, break_long_words=False, replace_whitespace=False\\n        )\\n        print(wrapped_text)\\n\\n        print(f\"done summary of {things} comments\")\\n\\n        return wrapped_text\\n\\n    else:\\n        return f\"There is no {things} comment\"\\n\\n\\n\\nWrite a final function to wrap up the statistics and comment functions\\nasync def get_result(url, youtubeapikey):\\n    parsed_url = urlparse(url)\\n    query_params = parse_qs(parsed_url.query)\\n    videoid = query_params.get(\\'v\\', [\\'\\'])[0]\\n\\n    youtube = build(\"youtube\", \"v3\", developerKey= youtubeapikey)\\n\\n    stats = await video_stats(youtube, videoid)\\n    df = await comment_threads(youtube, videoID=videoid)\\n    positive = await summary_of_comments(df,\\'positive\\')\\n    negative = await summary_of_comments(df,\\'negative\\')\\n    neutral = await summary_of_comments(df,\\'neutral\\')\\n\\n    return stats,df,videoid,positive,negative, neutral\\n\\nget_result is our final function that will be used in our Django code. As you may recall, in our previous function, we required a YouTube API Key and the link to the YouTube video. These two values are processed when the user submits the form, and then we utilize the get_result function to process them. If you don’t fully understand the process now, that’s okay; it will be our next step. I want you to keep it in mind. Once we finish this main code, we will explore the form and Django.\\nHTML Form\\n<form action = \"getoutput\" method = \"POST\" id = \"form\" class = \"mt-3 text-center flex\">\\n    {% csrf_token %}\\n    <input\\n        type = \"text\"\\n        name = \"videoid\"\\n        placeholder = \"Paste your youtube video url here\"\\n        class = \"m-2 px-3 py-1.5 border shadow rounded w-5/6 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-1 focus:ring-red-600 inline lg:text-lg\">\\n    <input\\n        type = \"submit\"\\n        class = \"m-2 px-3 py-1.5 rounded text-sm bg-red-600 text-white transition duration-300 ease-in-out hover:bg-black hover:shadow-lg lg:text-lg dark:hover:bg-white dark:hover:text-black\">  \\n</form>\\n\\nThis snippet is from the complete home.html, which includes the form where users can submit a YouTube video link. The key elements that connect this HTML form with our backend are the action, method, and name attributes. Here are the details:\\n\\nAction: “getoutput” is the name of our Django function. By specifying this in the form tag, we inform the HTML which function to execute when the user submits the form.\\nMethod: We use “POST” since we are uploading or posting new data or records to our backend. This method serves as a signal to Django, indicating that we want to create a new resource on the server with the data provided in the form. (More details about how Django handles different HTTP methods will be covered later.)\\nName: “videoid” is the name attribute that represents the value being passed to our backend. This name is used to identify and access the submitted data on the server side.\\n\\nWhen creating a form in Django, it’s important to remember that you need a CSRF token. The CSRF (Cross-Site Request Forgery) attack can trick the user’s browser into executing unwanted actions on an authenticated website. To prevent such attacks, Django includes a built-in security mechanism called the CSRF Token. This unique and unpredictable token is generated for each user session and is included as a hidden field in the form using the {% csrf_token %} template tag. Upon form submission, the CSRF Token is sent back to the server with the form data, and Django checks its validity. If the token is missing or incorrect, the request is rejected, safeguarding against potential CSRF attacks. In summary, including the CSRF Token in your HTML forms is essential to ensure the authenticity of form submissions and protect the integrity of your Django application.\\nDjango Model / Database (models.py)\\nIf you look your folder structure, inside your Django app, you will see models.py. This python file is a place for us to write a Django Model or database. Here are two databases that we will create together.\\n\\nApiKey Model: This model is used to store API keys associated with users. It has fields for the user (linked through a ForeignKey relationship), YouTube API key, OpenAI API key, and Hugging Face Hub API key.\\nResult Model: This model stores results related to YouTube videos. It includes fields for user, video ID, video title, views, likes, comments, positive/negative/neutral comments, and timestamps for creation and updates.\\n\\nfrom django.db import models\\nfrom django.contrib.auth.models import User\\n\\nclass ApiKey(models.Model):\\n    user = models.ForeignKey(User, on_delete=models.CASCADE)\\n    youtube_api_key= models.CharField(max_length=100, null=True, blank=True)\\n    openai_api_key = models.CharField(max_length=100, null=True, blank=True)\\n    huggingfacehub_api_key = models.CharField(max_length=100, null=True, blank=True)\\n\\nclass Result(models.Model):\\n    user = models.ForeignKey(User, on_delete=models.CASCADE)\\n    videoid= models.CharField(max_length=20, null=True, blank=True)\\n    videotitle= models.CharField(max_length=200, null=True, blank=True)\\n    view = models.CharField(max_length=20, null=True, blank=True)\\n    like = models.CharField(max_length=10, null=True, blank=True)\\n    comment = models.CharField(max_length=10, null=True, blank=True)\\n    total_positive_comment = models.CharField(max_length=10, null=True, blank=True)\\n    positive_comment = models.CharField(max_length=5000, null=True, blank=True)\\n    total_negative_comment = models.CharField(max_length=10, null=True, blank=True)\\n    negative_comment = models.CharField(max_length=5000, null=True, blank=True)\\n    total_neutral_comment = models.CharField(max_length=10, null=True, blank=True)\\n    neutral_comment = models.CharField(max_length=5000, null=True, blank=True)\\n    created_at = models.DateTimeField(auto_now_add=True)\\n    last_update = models.DateTimeField(auto_now=True)\\n\\n    def __str__(self):\\n        return self.videoid\\nAfter we have create a model or database, we should run two commands in our command prompt:\\n\\npython manage.py makemigrations: This command will analyze the changes we made to the models and create migration files in the migrations directory of our app.\\npython manage.py migrate: This command will execute the migrations and update the database schema to reflect the changes you made in your models.\\n\\n\\nRegister our Django model in admin.py\\nfrom django.contrib import admin\\nfrom .models import User, ApiKey, Result\\n\\n# Register your models here.\\nadmin.site.register(ApiKey)\\nadmin.site.register(Result)\\n\\nFill out our views.py\\nWe have register our database, so right now, let’s code. If you still remember the 3 key elements that connect the HTML form with our backend, we will use them here. The first one is the action “getoutput”. In our Django code, we create a POST function called “getoutput”, like the following code:\\ndef getoutput(request):\\n\\ncontext = {\\n    \\'user_id\\': request.user.pk\\n}\\n\\nif request.method == \"POST\":\\n    url = request.POST[\"videoid\"]\\n\\n    try:\\n        key = ApiKey.objects.get(user=request.user)\\n        youtubeapikey = key.youtube_api_key\\n        if youtubeapikey is None:\\n            youtubeapikey = os.environ.get(\\'youtubeapikey\\')\\n    except:\\n        youtubeapikey = os.environ.get(\\'youtubeapikey\\')\\n\\n    async def run_async():\\n        stats, df, videoid, positive, negative, neutral = await get_result(url, youtubeapikey, username, recipient_email)\\n\\n        source = {\\n            \\'videoid\\': videoid,\\n            \\'videotitle\\': stats[\\'title\\'],\\n            \\'view\\': stats[\\'viewCount\\'],\\n            \\'like\\': stats[\\'likeCount\\'],\\n            \\'comment\\': stats[\\'commentCount\\'],\\n            \\'total_positive_comment\\': len(df[df[\\'sentiment\\'] == \\'positive\\']),\\n            \\'total_negative_comment\\': len(df[df[\\'sentiment\\'] == \\'negative\\']),\\n            \\'total_neutral_comment\\': len(df[df[\\'sentiment\\'] == \\'neutral\\']),\\n            \\'positive_comment\\': positive,\\n            \\'negative_comment\\': negative,\\n            \\'neutral_comment\\': neutral,\\n        }\\n\\n        return source\\n\\n    loop = asyncio.new_event_loop()\\n    asyncio.set_event_loop(loop)\\n    source = loop.run_until_complete(run_async())\\n    loop.close()\\n\\n    current_user = request.user\\n    videoid = source[\\'videoid\\']\\n\\n    # Check if a record with the same videoid exists\\n    try:\\n        result = Result.objects.get(user=current_user, videoid=videoid)\\n        print(result)\\n    except Result.DoesNotExist:\\n        result = None\\n\\n    # If the record exists, update it; otherwise, create a new record\\n    if result:\\n        result.videotitle = source[\\'videotitle\\']\\n        result.view = source[\\'view\\']\\n        result.like = source[\\'like\\']\\n        result.comment = source[\\'comment\\']\\n        result.total_positive_comment = source[\\'total_positive_comment\\']\\n        result.positive_comment = source[\\'positive_comment\\']\\n        result.total_negative_comment = source[\\'total_negative_comment\\']\\n        result.negative_comment = source[\\'negative_comment\\']\\n    else:\\n        result = Result(\\n            user=current_user,\\n            videoid=videoid,\\n            videotitle= source[\\'videotitle\\'],\\n            view = source[\\'view\\'],\\n            like = source[\\'like\\'],\\n            comment = source[\\'comment\\'],\\n            total_positive_comment = source[\\'total_positive_comment\\'],\\n            positive_comment = source[\\'positive_comment\\'],\\n            total_negative_comment = source[\\'total_negative_comment\\'],\\n            negative_comment = source[\\'negative_comment\\']\\n        )\\n\\n    result.save()\\n\\n    return redirect(reverse(\\'chat\\') + f\\'?id={result.id}\\')\\n\\nelse:\\n    return render(request, \"home.html\", {\\'context\\':context})\\nThis code defines a Django view function named getoutput that handles a POST request. The primary purpose of this function is to fetch data about a YouTube video, perform sentiment analysis on its comments, and then store the results in a Django model named Result. Let’s break down the code step by step:\\n\\nThe context dictionary is initialized with the user’s ID, retrieved from the request.\\nThe function checks if the request method is POST (indicating form submission). If so, it extracts the video ID from the submitted form data.\\nAn attempt is made to retrieve the user’s YouTube API key from the ApiKey model. If not found, it falls back to using an API key from the environment variables.\\nAn asynchronous function named run_async is defined. This function retrieves statistics and sentiment analysis results for the given video URL and API key.\\nAn event loop is created using asyncio.new_event_loop() to execute the asynchronous function, and the loop is closed afterward.\\nThe current_user variable is assigned the user making the request, and the videoid is extracted from the source dictionary.\\nThe code checks if a Result record with the same videoid exists for the current user. If it exists, the record’s fields are updated with new data; otherwise, a new Result instance is created.\\nThe Result instance is saved to the database using result.save().\\nFinally, the function redirects the user to another view named \\'chat\\', passing the id of the stored Result record as a query parameter. More detail on this topic will be explained in part 2.\\nIf the request method is not POST (e.g., a GET request), the function renders the “home.html” template with the context data.\\n\\nThis view function serves as the backend logic for processing user input, fetching YouTube data, performing sentiment analysis, and storing the results in a Django model. It demonstrates how Django handles data manipulation, asynchronous operations, and database interactions in a web application.\\nAdd our getoutput view into urls.py\\nfrom django.urls import path\\nfrom . import views\\n\\nurlpatterns = [\\n    path(\\'\\', views.home, name=\"home\"),\\n    path(\\'getoutput\\',views.getoutput, name = \"getoutput\"),]\\n\\n\\nConclusion\\nIn this article, we embarked on a challenge to create a comprehensive web application that leverages the power of Django, sentiment analysis, and a Large Language Model to gain invaluable insights from YouTube comments. By blending data collection, analysis, and storage, we have built a tool that empowers content creators to better understand their audience’s sentiments and preferences. What’s most important, you now truly comprehend how to seamlessly integrate Large Language Models into our product, all for free and with ease.\\nAs we wrap up this initial phase, remember that the journey is far from over. Here’s a stimulating bonus challenge that will propel your skills to greater heights. Let’s shift gears and modify our approach. Instead of querying our database directly, we’re introducing a fascinating twist: the utilization of APIs.\\nTo embark on this challenge, follow these steps:\\n\\nBegin by installing Django REST Framework using the command pip install djangorestframework.\\nCreate a new file named serializers.py.\\nInside serializers.py, define a class named ResultSerializer.\\nIntegrate your serializers into view.py using the import statement from .serializers import ResultSerializer.\\nForge a path to access the API for CRUD operations; name it result.\\nAdd this new path to your urls.py configuration.\\n\\nSuccessfully completing this challenge will yield exciting results. When you type http://127.0.0.1:8000/result/1 into your browser, you’ll see a Django Rest Framework template and your data like this\\n\\nIn our upcoming Part 2, we’ll delve even deeper into the potential of Large Language Models and also Django REST Framework. We’ll pave the way for users to engage with an AI chatbot, enabling activities like seeking advice and exploring a myriad of other possibilities that an AI bot can seamlessly facilitate. This journey promises to unlock a realm of innovative interactions and dynamic user experiences.\\nRelevant Links\\n\\nProject Github: https://github.com/projectwilsen/ReviewAnalyzer/\\n\\n\\n\\n\\n\\nPost navigation\\n← Previous PostNext Post →\\n\\n\\n\\nLeave a Comment Cancel ReplyYour email address will not be published. Required fields are marked *Type here..Name*\\nEmail*\\nWebsite\\n Save my name, email, and website in this browser for the next time I comment.\\n \\n\\n \\n\\n\\n\\n \\n\\n\\n \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nRequest A Call \\n\\n\\n\\nPlease enable JavaScript in your browser to complete this form.Name *FirstLastCompanyWork Email *Your work email, so we can reach you. We respect your privacy and will not add you to any mailing list.CommentGet in touch \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nQuick Links \\n\\n\\n\\n\\n\\n\\n\\n \\nData Science Consulting\\n\\n\\n\\n\\n\\n \\nData Analysts For Hire\\n\\n\\n\\n\\n\\n \\nManaged Development\\n\\n\\n\\n\\n\\n \\n Development Program\\n\\n\\n\\n\\n\\n \\nArticles\\n\\n\\n\\n\\n\\n \\n Supertype on Linkedin\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\nCase Study (Data Science & Engineering)\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nGet In Touch \\n\\n\\n\\n\\n\\nCompany Address\\n\\n\\n160 Robinson Road #14-04 Singapore 068914\\n\\n\\n\\n\\n \\nContact Us\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nCopyright © 2024 Supertype | Supertype Pte Ltd (Registration 20207070N)\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nSitemap\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n\\t\\t\\t\\tGo to mobile version\\t\\t\\t\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n', metadata={'source': 'https://supertype.ai/notes/unveiling-youtube-insights-part-1/', 'title': 'Unveiling YouTube Insights - Introduction, Data Collection, Data Processing, and Database (Part 1) • Supertype', 'description': 'In this post, we will develop a website that integrates sentiment analysis techniques and a Large Language Model to provide a comprehensive understanding of YouTube comments, enabling users to extract meaningful information effortlessly.', 'language': 'en-US'})]\n"
     ]
    }
   ],
   "source": [
    "from langchain_community.document_loaders import WebBaseLoader\n",
    "loader = WebBaseLoader(\"https://supertype.ai/notes/unveiling-youtube-insights-part-1/\")\n",
    "pages = loader.load()\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4. Wikipedia Loader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Document(page_content='Samuel Harris Altman (born April 22, 1985) is an American entrepreneur and investor best known as the CEO of OpenAI since 2019 (he was briefly fired and reinstated in November 2023). Altman is considered to be one of the leading figures of the AI boom. He dropped out of Stanford University after two years and founded Loopt, a mobile social networking service, raising more than $30 million in venture capital. In 2011, Altman joined Y Combinator, a startup accelerator, and was its president from 2014 to 2019.\\n\\n\\n== Early life and education ==\\nAltman was born on April 22, 1985, in Chicago, Illinois, into a Jewish family, and grew up in St. Louis, Missouri. His mother is a dermatologist, while his father was a real estate broker. Altman is the eldest of four siblings. At the age of eight, he received his first computer, an Apple Macintosh, and began to learn how to code and take apart computer hardware. He attended John Burroughs School, a private school in Ladue, Missouri. In 2005, after two years at Stanford University studying computer science, he dropped out without earning a bachelor\\'s degree.\\n\\n\\n== Career ==\\n\\n\\n=== Early career ===\\nIn 2005, at the age of 19, Altman co-founded Loopt, a location-based social networking mobile application. As CEO, Altman raised more than $30 million in venture capital for the company, including an initial investment of $5 million from Patrick Chung of Xfund and his team at NEA, which was later followed by investments from Sequoia Capital and Y Combinator. In March 2012, after Loopt failed to gain traction with enough users, the company was acquired by the Green Dot Corporation for $43.4 million. The following month, Altman co-founded Hydrazine Capital with his brother, Jack Altman, which is still in operation.\\nAltman became a partner at Y Combinator, a startup accelerator that invests in a wide range of startups, in 2011, initially working there on a part-time basis. In February 2014, Altman was named president of Y Combinator by co-founder Paul Graham. In a 2014 blog post, Altman said that the total valuation of Y Combinator companies had surpassed $65 billion, including Airbnb, Dropbox, Zenefits and Stripe. In September 2016, Altman announced his expanded role as president of YC Group, which included Y Combinator and other units. Altman said that he hoped to expand Y Combinator to fund 1,000 new companies per year. He also tried to expand the types of companies funded by YC, especially \"hard technology\" companies. In October 2015, Altman announced YC Continuity, a $700 million equity fund investing in YC companies as they matured. A week earlier, Altman had introduced Y Combinator Research, a non-profit research lab, and donated $10 million to fund it. In March 2019, YC announced Altman\\'s transition from the president of the company to a less hands-on role as chairman of the board, for him to focus on OpenAI. This decision came shortly after YC announced it would be moving its headquarters to San Francisco. As of early 2020, he was no longer affiliated with YC. It was later reported that Altman was fired from YC and had appointed himself chairman without authorization.\\nAltman co-founded Tools For Humanity in 2019, a company which builds and distributes systems designed to scan people\\'s eyes to provide authentication and verify proof of personhood to counter fraud. People who agree to have their eyes scanned are compensated with a cryptocurrency called Worldcoin. Tools For Humanity describes its cryptocurrency as similar to universal basic income.\\nAltman has several other investments, including \"Humane,\" the world\\'s first wearable computer powered by AI, \"Retro Biosciences,\" a research company aiming to extend human life by 10 years, and \"Helion Energy,\" an American fusion research company.\\n\\n\\n=== OpenAI ===\\n\\nOpenAI was initially funded by Altman, Greg Brockman, Elon Musk, Jessica Livingston, Peter Thiel, Microsoft, Amazon Web Services, Infosys and YC Research. When OpenAI launched in 2015, it had', metadata={'title': 'Sam Altman', 'summary': 'Samuel Harris Altman (born April 22, 1985) is an American entrepreneur and investor best known as the CEO of OpenAI since 2019 (he was briefly fired and reinstated in November 2023). Altman is considered to be one of the leading figures of the AI boom. He dropped out of Stanford University after two years and founded Loopt, a mobile social networking service, raising more than $30 million in venture capital. In 2011, Altman joined Y Combinator, a startup accelerator, and was its president from 2014 to 2019.', 'source': 'https://en.wikipedia.org/wiki/Sam_Altman'}), Document(page_content='On November 17, 2023, OpenAI\\'s board of directors removed co-founder and chief executive Sam Altman after the board had no confidence in his leadership.  The removal was caused by concerns about his handling of Artificial Intelligence safety, and allegations of abusive behavior.  Altman was reinstated on November 22 after pressure from employees and investors.\\n\\n\\n== Background ==\\n\\n\\n=== OpenAI ===\\n\\nOpenAI is an artificial intelligence firm founded in December 2015 as a non-profit entity. The for-profit division of the organization released the chatbot ChatGPT in November 2022, contributing to a resurgence in generative artificial intelligence funding. The board of directors of the controlling non-profit formerly comprised chief scientist Ilya Sutskever, as well as Adam D\\'Angelo, chief executive of Quora, entrepreneur Tasha McCauley, and Helen Toner, strategy director for the Center for Security and Emerging Technology. As of October 2023, the company is valued at US$80 billion and was set to bring in US$1 billion in revenue. Altman has described OpenAI\\'s relationship with Microsoft as the \"best bromance in tech\".OpenAI is uniquely structured, an intentional decision to avoid investor control. A board of directors controls the non-profit OpenAI, Inc. The non-profit owns and controls a for-profit company itself controlling a capped-profit company, OpenAI Global, LLC and a holding company owned by employees and other investors. The holding company is the majority owner of OpenAI Global, LLC.; Microsoft owns a minority stake in the capped-profit company. OpenAI\\'s bylaws, enacted in January 2016, allow a majority of its board of directors to remove any director without prior warning or a formal meeting with written consent.\\n\\n\\n=== Sam Altman ===\\n\\nSam Altman is a co-founder of OpenAI and its former chief executive; Altman took over the company following co-chair Elon Musk\\'s resignation in 2018. Under Altman, OpenAI has shifted to becoming a for-profit entity. Altman is credited with convincing Microsoft chief executive Satya Nadella with investing US$10 billion in cash and computing credits into OpenAI and leading several tender offer transactions that tripled the company\\'s valuation. Altman testified before the United States Congress speaking critically of artificial intelligence and appeared at the 2023 AI Safety Summit.In the days leading up to his removal, Altman made several public appearances, announcing the GPT-4 Turbo platform at OpenAI\\'s DevDay conference, attending APEC United States 2023, and speaking at an event related to Burning Man.\\n\\n\\n== Events leading up to the removal ==\\nThe resignation of LinkedIn co-founder Reid Hoffman, venture capitalist Shivon Zilis, and former Republican representative Will Hurd from the board allowed the remaining members to remove Altman. According to Kara Swisher and The Wall Street Journal, Sutskever was instrumental in Altman\\'s removal. Disagreements over the safety of artificial intelligence divided employees prior to Altman\\'s removal. The release of ChatGPT created divisions with OpenAI as a for-profit company without considerations for the safety of artificial intelligence and a non-profit cautious of artificial intelligence\\'s capabilities; in a staff email sent in 2019 and obtained by The Atlantic, Altman referred to these divisions as \"tribes\".Prior to his removal, Altman was seeking billions from Middle Eastern sovereign wealth funds to develop an artificial intelligence chip to compete with Nvidia and courted SoftBank chairman Masayoshi Son to develop artificial intelligence hardware with former Apple designer Jony Ive. Sutskever and his allies opposed these efforts, viewing them as unjustly using the OpenAI name. Altman reduced Sutskever\\'s role in October 2023, furthering divisions; Sutskever successfully appealed to several members of the board. Swisher and The Verge reporter Alex Heath stated that opposition to Altman\\'s profit-driven strategy culminated in the DevDay conference in ', metadata={'title': 'Removal of Sam Altman from OpenAI', 'summary': \"On November 17, 2023, OpenAI's board of directors removed co-founder and chief executive Sam Altman after the board had no confidence in his leadership.  The removal was caused by concerns about his handling of Artificial Intelligence safety, and allegations of abusive behavior.  Altman was reinstated on November 22 after pressure from employees and investors.\\n\\n\", 'source': 'https://en.wikipedia.org/wiki/Removal_of_Sam_Altman_from_OpenAI'}), Document(page_content='OpenAI is a U.S.-based artificial intelligence (AI) research organization founded in December 2015, researching artificial intelligence with the goal of developing \"safe and beneficial\" artificial general intelligence, which it defines as \"highly autonomous systems that outperform humans at most economically valuable work\".\\nAs one of the leading organizations of the AI boom, it has developed several large language models, advanced image generation models, and previously, released open-source models. Its release of ChatGPT has been credited with starting the AI boom.\\nThe organization consists of the non-profit OpenAI, Inc. registered in Delaware and its for-profit subsidiary OpenAI Global, LLC. It was founded by Ilya Sutskever, Greg Brockman, Trevor Blackwell, Vicki Cheung, Andrej Karpathy, Durk Kingma, Jessica Livingston, John Schulman, Pamela Vagata, and Wojciech Zaremba, with Sam Altman and Elon Musk serving as the initial Board of Directors members. Microsoft provided OpenAI Global LLC with a $1 billion investment in 2019 and a $10 billion investment in 2023, with a significant portion of the investment in the form of computational resources on Microsoft\\'s Azure cloud service.\\nOn November 17, 2023, the board removed Altman as CEO, while Brockman was removed as chairman and then resigned as president. Four days later, both returned after negotiations with the board, and most of the board members resigned. The new initial board included former Salesforce co-CEO Bret Taylor as chairman. It was also announced that Microsoft will have a non-voting board seat.\\n\\n\\n== History ==\\n\\n\\n=== 2015–2018: Non-profit beginnings ===\\nIn December 2015, Sam Altman, Greg Brockman, Reid Hoffman, Jessica Livingston, Peter Thiel, Elon Musk, Amazon Web Services (AWS), Infosys, and YC Research announced the formation of OpenAI and pledged over $1 billion to the venture. The actual collected total amount of contributions was only $130 million until 2019. According to an investigation led by TechCrunch, Musk was its largest donor while YC Research did not contribute anything at all. The organization stated it would \"freely collaborate\" with other institutions and researchers by making its patents and research open to the public. OpenAI is headquartered at the Pioneer Building in Mission District, San Francisco.\\nAccording to Wired, Brockman met with Yoshua Bengio, one of the \"founding fathers\" of deep learning, and drew up a list of the \"best researchers in the field\". Brockman was able to hire nine of them as the first employees in December 2015. In 2016, OpenAI paid corporate-level (rather than nonprofit-level) salaries, but did not pay AI researchers salaries comparable to those of Facebook or Google.\\nMicrosoft\\'s Peter Lee stated that the cost of a top AI researcher exceeds the cost of a top NFL quarterback prospect. OpenAI\\'s potential and mission drew these researchers to the firm; a Google employee said he was willing to leave Google for OpenAI \"partly because of the very strong group of people and, to a very large extent, because of its mission.\" Brockman stated that \"the best thing that I could imagine doing was moving humanity closer to building real AI in a safe way.\" OpenAI co-founder Wojciech Zaremba stated that he turned down \"borderline crazy\" offers of two to three times his market value to join OpenAI instead.\\nIn April 2016, OpenAI released a public beta of \"OpenAI Gym\", its platform for reinforcement learning research. Nvidia gifted its first DGX-1 supercomputer to OpenAI in August 2016 to help it train larger and more complex AI models with the capability of reducing processing time from six days to two hours. In December 2016, OpenAI released \"Universe\", a software platform for measuring and training an AI\\'s general intelligence across the world\\'s supply of games, websites, and other applications.\\nIn 2017 OpenAI spent $7.9 million, or a quarter of its functional expenses, on cloud computing alone. In comparison, DeepMind\\'s total expenses ', metadata={'title': 'OpenAI', 'summary': 'OpenAI is a U.S.-based artificial intelligence (AI) research organization founded in December 2015, researching artificial intelligence with the goal of developing \"safe and beneficial\" artificial general intelligence, which it defines as \"highly autonomous systems that outperform humans at most economically valuable work\".\\nAs one of the leading organizations of the AI boom, it has developed several large language models, advanced image generation models, and previously, released open-source models. Its release of ChatGPT has been credited with starting the AI boom.\\nThe organization consists of the non-profit OpenAI, Inc. registered in Delaware and its for-profit subsidiary OpenAI Global, LLC. It was founded by Ilya Sutskever, Greg Brockman, Trevor Blackwell, Vicki Cheung, Andrej Karpathy, Durk Kingma, Jessica Livingston, John Schulman, Pamela Vagata, and Wojciech Zaremba, with Sam Altman and Elon Musk serving as the initial Board of Directors members. Microsoft provided OpenAI Global LLC with a $1 billion investment in 2019 and a $10 billion investment in 2023, with a significant portion of the investment in the form of computational resources on Microsoft\\'s Azure cloud service.\\nOn November 17, 2023, the board removed Altman as CEO, while Brockman was removed as chairman and then resigned as president. Four days later, both returned after negotiations with the board, and most of the board members resigned. The new initial board included former Salesforce co-CEO Bret Taylor as chairman. It was also announced that Microsoft will have a non-voting board seat.', 'source': 'https://en.wikipedia.org/wiki/OpenAI'}), Document(page_content='Worldcoin is an iris biometric cryptocurrency project developed by San Francisco- and Berlin-based Tools for Humanity. Founded in 2019 by OpenAI chief executive Sam Altman, Max Novendstern, and Alex Blania, it is backed by VC Andreessen Horowitz.\\n\\n\\n== History ==\\nWorldcoin project was started by a company called Tools for Humanity (TFH), founded by Sam Altman, Max Novendstern and Alex Blania in 2019.\\nIn 2021, the company stated that its token (WLD) is intended to be a larger effort to drive a more unified and equitable global economy driven by the internet economy, although it will not be available in the USA. The token will be a Layer 2 Ethereum-based cryptocurrency that leverages the security of the Ethereum blockchain while having its own economy.\\nIn October 2021, the project raised an initial $25 million. Within six months, an additional $100 million was raised, pushing the token\\'s value up to $3 billion.\\nIn April 2022, a report from MIT Technology Review cited those from the community who accused Worldcoin of \"taking advantage of students\" and \"targeting lower-income communities\", and came to the conclusion that \"it\\'s just cheaper and easier to run this kind of data collection operation in places where people have little money and few legal protections.\"\\nIn May 2023, TechCrunch reported that hackers had been able to steal login credentials of several of Worldcoin\\'s operators\\' personal devices including their credentials to the Worldcoin operator app. However, Worldcoin\\'s spokesperson said that no personal user data was compromised, as the operator app does not access user data.\\nFurther funding of $115 million was announced in May 2023, to be used for investment into bot detection, research and development, and expanding the Worldcoin project and application. While in beta, Worldcoin was reported to have onboarded approximately two million users.\\nWorldcoin launched out of beta on July 24, 2023 with 11 orb locations in the U.S. and plans for 35 cities in 20 countries. Users in London received 25 WLD tokens for scanning their irises. WLD tokens became freely tradable on several cryptocurrency exchanges, though not in the U.S.\\nIn August 2023, Kenya, one of the first countries where Worldcoin was launched, suspended its enrollment in the country, citing security, privacy and financial concerns. Worldcoin was previously ordered to stop collecting personal data by the Kenyan Office of the Data Protection Commissioner, but did not comply. Worldcoin also stopped offline verifications in India.\\nOn March 6, 2024, the Spanish Data Protection Agency (AEPD) ordered Worldcoin to stop its activity of “collection of biometric data” and to “block all data collected in Spanish territory”.\\n\\n\\n== Design ==\\n\\nWorldcoin hopes to provide a reliable way to authenticate humans online called World ID, to counter bots and fake virtual identities facilitated by artificial intelligence. Worldcoin attempts to recruit new users to join its network by getting their iris scanned using Worldcoin\\'s orb-shaped iris scanner in return for some WLD tokens. In order to access their WLD, users are required to provide an email address or phone number and use the Worldcoin app. Worldcoin claims the distribution mechanism was inspired by universal basic income discussions.\\nTen percent of all WLD tokens are reserved for Worldcoin investors, and another 10 percent are reserved for Worldcoin employees. Worldcoin uses so-called \"operators\" to sign up new users. These are independent contractors paid per sign-up in Tether stable coin.\\n\\n\\n== Controversies ==\\nThe currency has not formally launched in the US and other countries because of concerns by national regulators regarding privacy and potential use of the tokens for fraudulent purposes.\\nIn late January 2024 representatives of the Hong Kong Office of the Privacy Commissioner for Personal Data executed warrants on six Worldcoin offices in Hong Kong. Some of the offices had been used to collect iris scans. The commissioner\\'', metadata={'title': 'Worldcoin', 'summary': 'Worldcoin is an iris biometric cryptocurrency project developed by San Francisco- and Berlin-based Tools for Humanity. Founded in 2019 by OpenAI chief executive Sam Altman, Max Novendstern, and Alex Blania, it is backed by VC Andreessen Horowitz.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Worldcoin'}), Document(page_content='Ilya Sutskever  (; Hebrew: איליה סוצקבר; Russian: Илья́  Суцке́вер [ɪˈlʲja  sʊtsˈkʲevʲɪr] born 1985/86) is a Russian-born computer scientist working in machine learning. Sutskever is a co-founder and Chief Scientist at OpenAI. He holds citizenship in Russia, Israel, and Canada.\\nHe has made several major contributions to the field of deep learning. In 2023, Sutskever was one of the members of the OpenAI board who fired CEO Sam Altman; Altman returned a week later, and Sutskever stepped down from the board. He is the co-inventor, with Alex Krizhevsky and Geoffrey Hinton, of AlexNet, a convolutional neural network. Sutskever is also one of the many co-authors of the AlphaGo paper.\\n\\n\\n== Early life and education ==\\nSutskever was born in Nizhny Novgorod, Russia, then called Gorky, at the time part of the Soviet Union, and at age 5 immigrated with his family to Israel, where he lived until age 15.\\nSutskever attended the Open University of Israel between 2000 and 2002. After that, he moved to Canada with his family and attended the University of Toronto in Ontario.\\nFrom the University of Toronto, Sutskever received a Bachelor of Science in mathematics in 2005, a Master of Science in computer science in 2007, and a Doctor of Philosophy in computer science in 2013. His doctoral supervisor was Geoffrey Hinton.\\nIn 2012, Sutskever built AlexNet in collaboration with Hinton and Alex Krizhevsky. To support the computing demands of AlexNet, Sutskever bought many GTX 580 GPUs online.\\n\\n\\n== Career and research ==\\n\\nFrom November to December 2012, Sutskever spent about two months as a postdoc with Andrew Ng at Stanford University. He then returned to the University of Toronto and joined Hinton\\'s new research company DNNResearch, a spinoff of Hinton\\'s research group. Four months later, in March 2013, Google acquired DNNResearch and hired Sutskever as a research scientist at Google Brain.\\nAt Google Brain, Sutskever worked with Oriol Vinyals and Quoc Viet Le to create the sequence-to-sequence learning algorithm, and worked on TensorFlow.\\nAt the end of 2015, he left Google to become cofounder and chief scientist of the newly founded organization OpenAI.\\nIn 2023, he announced that he will co-lead OpenAI\\'s new \"Superalignment\" project, which tries to solve the alignment of superintelligences in 4 years. He wrote that even if superintelligence seems far off, it could happen this decade.\\nSutskever was formerly one of the six board members of the non-profit entity which controls OpenAI. The Information speculated that the firing of Sam Altman in part resulted from a conflict over the extent to which the company should commit to AI safety. In a company all-hands meeting shortly after the board meeting, Sutskever stated that firing Altman was \"the board doing its duty\", though in the following week, he expressed regret at having participated in Altman\\'s ousting. The firing of Altman and resignation of Brockman led to resignation of three senior researchers from OpenAI. Following these events, Sutskever stepped down from the board of OpenAI.\\n\\n\\n=== Awards and honours ===\\n2015, Sutskever was named in MIT Technology Review\\'s 35 Innovators Under 35.\\n2018, Sutskever was the keynote speaker at Nvidia Ntech 2018 and AI Frontiers Conference 2018.\\n2022, he was elected a Fellow of the Royal Society (FRS).\\n\\n\\n== References ==', metadata={'title': 'Ilya Sutskever', 'summary': 'Ilya Sutskever  (; Hebrew: איליה סוצקבר; Russian: Илья́  Суцке́вер [ɪˈlʲja  sʊtsˈkʲevʲɪr] born 1985/86) is a Russian-born computer scientist working in machine learning. Sutskever is a co-founder and Chief Scientist at OpenAI. He holds citizenship in Russia, Israel, and Canada.\\nHe has made several major contributions to the field of deep learning. In 2023, Sutskever was one of the members of the OpenAI board who fired CEO Sam Altman; Altman returned a week later, and Sutskever stepped down from the board. He is the co-inventor, with Alex Krizhevsky and Geoffrey Hinton, of AlexNet, a convolutional neural network. Sutskever is also one of the many co-authors of the AlphaGo paper.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Ilya_Sutskever'}), Document(page_content='Ermira \"Mira\" Murati (born 16 December 1988) is an Albanian engineer, researcher, and tech executive, who has been the Chief Technology Officer of OpenAI since 2018.\\n\\n\\n== Early life and education ==\\nMurati was born on 16 December 1988 in Vlorë, Albania. Throughout her school years, she participated in many Olympiads and math competitions.\\nAt age 16, she won a scholarship and went to high school at the Pearson United World College of the Pacific on Vancouver Island, British Columbia, Canada, where she graduated in 2005. For her undergraduate education, she attended Colby College and Dartmouth College (Thayer School of Engineering), where she studied mechanical engineering. \\n\\n\\n== Career ==\\n\\n\\n=== Early career ===\\nMurati briefly worked for Zodiac Aerospace before joining electric car company Tesla in 2013, where she was a Product Manager on the Model X. From 2016 until joining OpenAI in 2018, she worked for augmented reality start-up Leap Motion (now Ultraleap).\\n\\n\\n=== OpenAI ===\\nMurati joined OpenAI in 2018 as a researcher, and became its chief technology officer, leading its work on ChatGPT, Dall-E, Codex and Sora, while overseeing its research, product and safety teams. She oversees the technical advancements and direction of OpenAI\\'s various projects, including the development of advanced AI models and tools. Her work has been instrumental in the development and deployment of some of OpenAI\\'s most notable products, such as the Generative Pretrained Transformer (GPT) series of language models. Her work includes pushing the boundaries of machine learning while advocating for the responsible and ethical use of AI technologies.\\nOn 17 November 2023, Murati briefly took over as interim chief executive officer of OpenAI following the abrupt removal of Sam Altman. She was replaced by Emmett Shear three days later, who was in turn replaced when Altman was reinstated five days after being ousted (after which Murati returned to her role as CTO).\\nWriting about Murati for Time\\'s 2023 100 Next list of rising leaders across industries, Microsoft CEO Satya Nadella said, \"She has a demonstrated ability to assemble teams with technical expertise, commercial acumen, and a deep appreciation for the importance of mission ... Mira has helped build some of the most exciting AI technologies we’ve ever seen, including ChatGPT, DALL-E, and GPT-4.\"\\n\\n\\n== Publications ==\\nMurati, Ermira. Language & Coding Creativity, Dædalus, Spring 2022\\n\\n\\n== References ==\\n\\n\\n== External links ==\\nMira Murati on Twitter', metadata={'title': 'Mira Murati', 'summary': 'Ermira \"Mira\" Murati (born 16 December 1988) is an Albanian engineer, researcher, and tech executive, who has been the Chief Technology Officer of OpenAI since 2018.', 'source': 'https://en.wikipedia.org/wiki/Mira_Murati'}), Document(page_content=\"Y Combinator Management, LLC (YC) is an American technology startup accelerator and venture capital firm launched in March 2005 which has been used to launch more than 4,000 companies. The accelerator program started in Boston and Mountain View, expanded to San Francisco in 2019, and was entirely online during the COVID-19 pandemic. Companies started via Y Combinator include Airbnb, Coinbase, Cruise, DoorDash, Dropbox, Instacart, Reddit, Stripe, and Twitch.\\n\\n\\n== History ==\\nFounded in 2005 by Paul Graham, Jessica Livingston, Robert Tappan Morris, and Trevor Blackwell, Y Combinator (YC) initiated operations with concurrent programs in Cambridge, Massachusetts, and Mountain View, California. However, operational complexities arising from managing two programs prompted a consolidation in January 2009, resulting in the closing of the Cambridge program and the centralization of activities in Silicon Valley.\\nIn 2009, Y Combinator secured a $2 million investment led by Sequoia Capital, enabling increased annual funding for around 60 companies. Sequoia further supported YC in 2010 through an $8.25 million funding round, bolstering the organization's capability to accommodate a growing number of startups. Concurrently, Kirsty Nathoo joined the team, initially as an accountant, and subsequently as the Chief Financial Officer (CFO) in 2012. In 2011, Yuri Milner and SV Angel offered every Y Combinator company a $150,000 convertible note investment. The amount put into each company was changed to $80,000 when Start Fund was renewed.\\n\\nAdvisory roles were assumed by Harj Taggar and Alexis Ohanian in 2010, and Paul Buchheit and Harj Taggar were named partners in November. Michael Seibel joined Y Combinator as a part-time partner in January 2013 before becoming a full-time partner in 2014. In September 2013, Y Combinator began funding nonprofit organizations that were accepted into the program after testing the concept with Watsi. Sam Altman took part in Y Combinator's inaugural cohort in 2005 as a founder. In 2014, Paul Graham appointed him as President. Altman introduced a revised equity offering of $150,000 for a 7% stake. Collaborations with Transcriptic and Bolt improved support for biotech and hardware startups.\\nGlobal outreach became evident in 2016 as YC partners embarked on visits to 11 countries (Nigeria, Denmark, Portugal, Sweden, Germany, Russia, Argentina, Chile, Mexico, Israel, and India) to engage with founders and learn about international startup communities. That summer, Altman returned to Y Combinator as a founder and worked on OpenAI. Leadership responsibilities were delegated to Ali Rowghani and Michael Seibel for YC Continuity and YC Core programs, respectively. Startup School, introduced in 2017, provided startups with online courses and personalized coaching. More than 1500 startups graduated from the program in its first year.\\nIn 2018, Y Combinator announced a new batch of startup schools. After a software glitch, all 15,000 startups that applied to the program were accepted, only to learn a few hours later that they had been rejected. In response to the ensuing outcry, Y Combinator's accepted all 15,000 companies involved in the incident. The same year, Qi Lu, a former CEO of Bing and Baidu, briefly assumed the role of CEO for YC China. In November, YC announced Lu's departure and their decision to not pursue a program in China. YC China later morphed into MiraclePlus, an accelerator similar to YC, with Lu once again at the helm. Geoff Ralston succeeded Altman as Y Combinator's President in 2019.\\nAdapting to the COVID-19 pandemic, Y Combinator conducted its summer 2020 batch remotely. In January 2022, a revised standard deal of $500,000 was introduced, comprising $125,000 for a 7% equity stake and an additional $375,000 via an uncapped safe mechanism incorporating a Most Favored Nation (MFN) clause. The summer of 2022 saw a deliberate reduction in the startup intake by 40%, from 414 companies to 250.\\nIn January 2023, G\", metadata={'title': 'Y Combinator', 'summary': 'Y Combinator Management, LLC (YC) is an American technology startup accelerator and venture capital firm launched in March 2005 which has been used to launch more than 4,000 companies. The accelerator program started in Boston and Mountain View, expanded to San Francisco in 2019, and was entirely online during the COVID-19 pandemic. Companies started via Y Combinator include Airbnb, Coinbase, Cruise, DoorDash, Dropbox, Instacart, Reddit, Stripe, and Twitch.', 'source': 'https://en.wikipedia.org/wiki/Y_Combinator'}), Document(page_content='Helen Toner is an Australian researcher and former board member of OpenAI.\\n\\n\\n== Early life and education ==\\nToner was born in 1992 in Melbourne, Australia. She graduated from the University of Melbourne in 2014 and participated in UN Youth, an organization that provides student engagement in international diplomacy simulations. During her time at the university, she was recognized by her peers for her academic and extracurricular activities.\\n\\n\\n== Career ==\\nToner\\'s career includes involvement with the effective altruism movement, which focuses on using resources efficiently for charitable impact and ethical development in artificial intelligence. After graduating, she worked with GiveWell and Open Philanthropy, an initiative co-founded by Dustin Moskovitz.\\nToner also worked in China studying the AI industry. She later worked as a research affiliate at the University of Oxford\\'s centre for the governance of AI, before becoming Georgetown\\'s Center for Security and Emerging Technology\\'s director of strategy and foundational research grants. She has co-written articles in Foreign Affairs.\\nIn late 2021 Toner was appointed to the board of OpenAI. OpenAI is owned by investors including Microsoft, but the organization has retained its non-for-profit governance structure, making board members accountable to the organization\\'s altruistic goals, rather than shareholders.\\nIn October 2023 she published the report \"Decoding Intentions: Artificial Intelligence and Costly Signals\" with two co-authors, writing\\n\\nOpenAI has also drawn criticism for many other safety and ethics issues related to the launches of ChatGPT and GPT-4, including regarding copyright issues, labor conditions for data annotators, and the susceptibility of their products to “jailbreaks” that allow users to bypass safety controls.\\nAfter the paper’s publication, Altman tried to push out Toner because he thought the paper was critical of the company.\\nOn November 17, 2023 Toner along with three other board members voted to remove Sam Altman as CEO of OpenAI. The board\\'s stated reason was that Altman was \"not consistently candid in his communications” with the board, and was influenced by perceptions that Altman was manipulating board members for his own gain. Four days later, the decision was revoked and she was removed from the board of directors.\\n\\n\\n== References ==\\n\\n\\n== External links ==\\n\\nGeorgetown Website Profile', metadata={'title': 'Helen Toner', 'summary': 'Helen Toner is an Australian researcher and former board member of OpenAI.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Helen_Toner'}), Document(page_content='Loopt, Inc. was an American company based in Mountain View, California, which provided a service for smartphone users to share their location selectively with other people. The service supported all the major mobile operating systems. Loopt\\'s services had more than five million registered users and partnerships with every major U.S. mobile phone carrier. Their applications offered a variety of privacy controls. In addition to its core features, users also had the ability to integrate Loopt with other social networks, including Facebook and Twitter.\\nThe company was founded in 2005 and received initial funding from Y Combinator, and completed Series A and B financing led by Sequoia Capital and New Enterprise Associates. The company\\'s board members included TiVo-founder Mike Ramsay and Greg McAdoo of Sequoia Capital. In March 2012 Loopt agreed to be acquired by Green Dot Corporation for $43.4 million in cash, with $9.8 million of that to be set aside for employee retention.\\n\\n\\n== History ==\\nInitially called Radiate, Loopt began with funding from Y Combinator. That summer, Stanford sophomores Sam Altman and Nick Sivo worked to build the first prototype of Loopt. They were later joined by Alok Deshpande as well as two of Sam\\'s childhood friends, Rick & Tom Pernikoff.\\nLoopt received US$5 million in Series A funding from Sequoia Capital and New Enterprise Associates and struck a deal to launch the service on Boost Mobile devices in September 2006. Boost Mobile featured Loopt in a series of commercials that are most known for the \"Where you at?\" tag line.\\nIn August 2007, Loopt expanded the service to select Sprint phones, and in June 2008, to Verizon. Loopt announced support for most GPS-enabled Blackberries on June 13, 2008. Loopt received US$8.25 million in Series B funding in July 2007.\\nIn February 2008, Loopt and CBS partnered to deliver location based advertising. Seven months later, Loopt released an opt-in feature in Loopt\\'s iPhone application, called Loopt Mix, which uses location-based services to enable iPhone users to find and meet new people nearby.\\nAt Apple\\'s Worldwide Developers Conference in June 2008, Altman presented the Loopt application for the iPhone. Loopt for the iPhone became available to US customers of the Apple iTunes App Store on July 11, 2008.\\nIn the summer of 2008, Loopt sponsored Black20.com\\'s The Middle Show with host Dave Price.\\nIn October 2008, Loopt was sued by Earthcomber for patent infringement. The case was dropped by Earthcomber in March 2009.\\nIn October 2009, Loopt acquired Y Combinator-backed startup GraffitiGeo for an undisclosed sum.\\nIn March 2010, Loopt launched an upgraded version of its iPhone app, incorporating place and event information to its Pulse database, bringing in content from ZVents, Metromix, and SonicLiving.  These are added to existing content partnerships with Citysearch, Zagat, and Bing.\\nIn March 2010, Loopt launched a product called Loopt Pulse, exclusively designed for the iPad.\\nIn April 2010, Loopt launched an upgraded version of its BlackBerry app. The upgraded version includes the same places and events upgrade formerly launched in March 2010 for iPhone users.\\nIn December 2010, Loopt launched Loopt version 4.0, which featured a completely updated design.\\nIn March 2012, after raising more than $30M in venture capital, Loopt announced it had agreed to be acquired by Green Dot Corporation for US$43.4 million.\\n\\n\\n== SMS invitation issues ==\\nUsers of Loopt must register their mobile phone number, full name, and date of birth. Loopt\\'s privacy notice states that users can control who receives geo-location information via privacy settings.\\nWhen Loopt released its native iPhone application on July 10, 2008, the software quickly gained notoriety for sending Short Message Service (SMS) invites to users\\' address books, seemingly without the user\\'s knowledge; additionally, the SMS service failed to respond to the industry required STOP message. \\nOn July 14, 2008, Loopt posted to its b', metadata={'title': 'Loopt', 'summary': \"Loopt, Inc. was an American company based in Mountain View, California, which provided a service for smartphone users to share their location selectively with other people. The service supported all the major mobile operating systems. Loopt's services had more than five million registered users and partnerships with every major U.S. mobile phone carrier. Their applications offered a variety of privacy controls. In addition to its core features, users also had the ability to integrate Loopt with other social networks, including Facebook and Twitter.\\nThe company was founded in 2005 and received initial funding from Y Combinator, and completed Series A and B financing led by Sequoia Capital and New Enterprise Associates. The company's board members included TiVo-founder Mike Ramsay and Greg McAdoo of Sequoia Capital. In March 2012 Loopt agreed to be acquired by Green Dot Corporation for $43.4 million in cash, with $9.8 million of that to be set aside for employee retention.\", 'source': 'https://en.wikipedia.org/wiki/Loopt'}), Document(page_content=\"Greg Brockman (born November 29, 1987) is an American entrepreneur, investor and software developer who is a co-founder and currently the president of OpenAI. He began his career at Stripe in 2010, upon leaving MIT, and became their CTO in 2013. He left Stripe in 2015 to co-found OpenAI, where he also assumed the role of CTO.\\n\\n\\n== Early life and education ==\\nBrockman was born in Thompson, North Dakota, and attended Red River High School, where he excelled in mathematics, chemistry, and computer science. He won a silver medal in the 2006 International Chemistry Olympiad and became the first finalist from North Dakota to participate in the Intel science talent search since 1973. In 2007, he attended Canada/USA Mathcamp, a summer program for mathematically talented high-school students. In 2008, Brockman enrolled in Harvard University, but left only a year later, before briefly enrolling at Massachusetts Institute of Technology.\\n\\n\\n== Career ==\\nIn 2010, he dropped out of MIT to join Stripe, Inc., a company founded by Patrick Collison, an MIT classmate, and his brother, John Collison. In 2013, he became Stripe's first-ever CTO, and grew the company from 5 to 205 employees. Brockman left Stripe in May 2015, and co-founded OpenAI in December 2015 with Sam Altman and Ilya Sutskever.\\nBrockman helped create the OpenAI founding team, and led various prominent projects early on at OpenAI, including OpenAI Gym and OpenAI Five, a Dota 2 bot.\\nOn February 14, 2019, OpenAI announced that they had developed a new large language model called GPT-2, but kept it private due to their concern for its potential misuse. They finally released the model to a limited group of beta testers in May 2019.\\nOn March 14, 2023, in a live video demo, Brockman unveiled GPT-4, the fourth iteration in the GPT series, and the newest language model created by OpenAI.\\nOn November 17, 2023, along with the firing of Sam Altman from OpenAI, Greg Brockman was told he was being removed from the board, but was vital to the company and would remain in his role at the company, reporting to the CEO. He later in the day announced on X (formerly known as Twitter) he had quit the company.\\nOn November 20, 2023, Microsoft CEO Satya Nadella announced that Brockman and former OpenAI CEO Sam Altman would join Microsoft to lead a new advanced AI research team. The following day, after a deal was reached to reinstate Altman as CEO, Brockman returned to OpenAI.\\n\\n\\n== Personal life ==\\nIn November 2019, Brockman married his girlfriend, Anna.\\n\\n\\n== References ==\", metadata={'title': 'Greg Brockman', 'summary': 'Greg Brockman (born November 29, 1987) is an American entrepreneur, investor and software developer who is a co-founder and currently the president of OpenAI. He began his career at Stripe in 2010, upon leaving MIT, and became their CTO in 2013. He left Stripe in 2015 to co-found OpenAI, where he also assumed the role of CTO.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Greg_Brockman'}), Document(page_content='Generative Pre-trained Transformer 4 (GPT-4) is a multimodal large language model created by OpenAI, and the fourth in its series of GPT foundation models. It was launched on March 14, 2023, and made publicly available via the paid chatbot product ChatGPT Plus, via OpenAI\\'s API, and via the free chatbot Microsoft Copilot.  As a transformer-based model, GPT-4 uses a paradigm where pre-training using both public data and \"data licensed from third-party providers\" is used to predict the next token. After this step, the model was then fine-tuned with reinforcement learning feedback from humans and AI for human alignment and policy compliance.:\\u200a2\\u200a\\nObservers reported that the iteration of ChatGPT using GPT-4 was an improvement on the previous iteration based on GPT-3.5, with the caveat that GPT-4 retains some of the problems with earlier revisions. GPT-4, equipped with vision capabilities (GPT-4V), is capable of taking images as input on ChatGPT. OpenAI has declined to reveal various technical details and statistics about GPT-4, such as the precise size of the model.\\n\\n\\n== Background ==\\n \\nOpenAI introduced the first GPT model (GPT-1) in 2018, publishing a paper called \"Improving Language Understanding by Generative Pre-Training.\" It was based on the transformer architecture and trained on a large corpus of books. The next year, they introduced GPT-2, a larger model that could generate coherent text. In 2020, they introduced GPT-3, a model with 100 times as many parameters as GPT-2, that could perform various tasks with few examples. GPT-3 was further improved into GPT-3.5, which was used to create the chatbot product ChatGPT.\\nRumors claim that GPT-4 has 1.76 trillion parameters, which was first estimated by the speed it was running and by George Hotz.\\n\\n\\n== Capabilities ==\\nOpenAI stated that GPT-4 is \"more reliable, creative, and able to handle much more nuanced instructions than GPT-3.5.\" They produced two versions of GPT-4, with context windows of 8,192 and 32,768 tokens, a significant improvement over GPT-3.5 and GPT-3, which were limited to 4,096 and 2,049 tokens respectively. Some of the capabilities of GPT-4 were predicted by OpenAI before training it, although other capabilities remained hard to predict due to breaks in downstream scaling laws. Unlike its predecessors, GPT-4 is a multimodal model: it can take images as well as text as input; this gives it the ability to describe the humor in unusual images, summarize text from screenshots, and answer exam questions that contain diagrams. It  can now interact with users through spoken words and respond to images, allowing for more natural conversations and the ability to provide suggestions or answers based on photo uploads. \\nTo gain further control over GPT-4, OpenAI introduced the \"system message\", a directive in natural language given to GPT-4 in order to specify its tone of voice and task. For example, the system message can instruct the model to \"be a Shakespearean pirate\", in which case it will respond in rhyming, Shakespearean prose, or request it to \"always write the output of [its] response in JSON\", in which case the model will do so, adding keys and values as it sees fit to match the structure of its reply. In the examples provided by OpenAI, GPT-4 refused to deviate from its system message despite requests to do otherwise by the user during the conversation.\\nWhen instructed to do so, GPT-4 can interact with external interfaces. For example, the model could be instructed to enclose a query within <search></search> tags to perform a web search, the result of which would be inserted into the model\\'s prompt to allow it to form a response. This allows the model to perform tasks beyond its normal text-prediction capabilities, such as using APIs, generating images, and accessing and summarizing webpages.\\nA 2023 article in Nature stated programmers have found GPT-4 useful for assisting in coding tasks (despite its propensity for error), such as finding errors in existing cod', metadata={'title': 'GPT-4', 'summary': 'Generative Pre-trained Transformer 4 (GPT-4) is a multimodal large language model created by OpenAI, and the fourth in its series of GPT foundation models. It was launched on March 14, 2023, and made publicly available via the paid chatbot product ChatGPT Plus, via OpenAI\\'s API, and via the free chatbot Microsoft Copilot.  As a transformer-based model, GPT-4 uses a paradigm where pre-training using both public data and \"data licensed from third-party providers\" is used to predict the next token. After this step, the model was then fine-tuned with reinforcement learning feedback from humans and AI for human alignment and policy compliance.:\\u200a2\\u200a\\nObservers reported that the iteration of ChatGPT using GPT-4 was an improvement on the previous iteration based on GPT-3.5, with the caveat that GPT-4 retains some of the problems with earlier revisions. GPT-4, equipped with vision capabilities (GPT-4V), is capable of taking images as input on ChatGPT. OpenAI has declined to reveal various technical details and statistics about GPT-4, such as the precise size of the model.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/GPT-4'}), Document(page_content='Reddit () is an American social news aggregation, content rating, and forum social network. Registered users (commonly referred to as \"Redditors\") submit content to the site such as links, text posts, images, and videos, which are then voted up or down by other members. Posts are organized by subject into user-created boards called \"communities\" or \"subreddits\". Submissions with more upvotes appear towards the top of their subreddit and, if they receive enough upvotes, ultimately on the site\\'s front page. Reddit administrators moderate the communities. Moderation is also conducted by community-specific moderators, who are not Reddit employees. It is operated by Reddit, Inc., based in San Francisco.\\nAs of October 2023, Reddit is the 18th most-visited website in the world. According to data provided by Similarweb, 48.98% of the website traffic comes from the United States, followed by the United Kingdom at 7.06% and Canada at 6.9%.\\nReddit was founded by University of Virginia roommates Steve Huffman and Alexis Ohanian, as well as Aaron Swartz, in 2005. Condé Nast Publications acquired the site in October 2006. In 2011, Reddit became an independent subsidiary of Condé Nast\\'s parent company, Advance Publications. In October 2014, Reddit raised $50 million in a funding round led by Sam Altman and including investors Marc Andreessen, Peter Thiel, Ron Conway, Snoop Dogg, and Jared Leto. Their investment valued the company at $500 million at the time. In July 2017, Reddit raised $200 million for a $1.8 billion valuation, with Advance Publications remaining the majority stakeholder. In February 2019, a $300 million funding round led by Tencent brought the company\\'s valuation to $3 billion. In August 2021, a $700 million funding round led by Fidelity Investments raised that valuation to over $10 billion. The company then reportedly filed for an IPO in December 2021 with a valuation of $15 billion. Reddit debuted on the stock market on the morning of March 21, 2024 with the ticker symbol RDDT.\\nReddit has received praise for many of its features, such as the ability to create several subreddits for niche communities, being a platform for raising publicity for numerous causes, and has grown to be one of the most visited websites on the Internet. It has also received criticism for spreading misinformation.\\n\\n\\n== History ==\\n\\nThe idea and initial development of Reddit originated with college roommates Steve Huffman and Alexis Ohanian in 2005, who attended a lecture by programmer-entrepreneur Paul Graham in Boston, Massachusetts, during their spring break from University of Virginia. After speaking with Huffman and Ohanian following the lecture, Graham invited the two to apply to his startup incubator Y Combinator. Their initial idea, My Mobile Menu, was unsuccessful, and was intended to allow users to order food by SMS text messaging. During a brainstorming session to pitch another startup, the idea was created for what Graham called the \"front page of the Internet\". For this idea, Huffman and Ohanian were accepted in Y Combinator\\'s first class. Supported by the funding from Y Combinator, Huffman coded the site in Common Lisp and together with Ohanian launched Reddit in June 2005. Embarrassed by an empty-looking site, the founders created hundreds of fake users for their posts to make it look more populated, an example of a fake it till you make it strategy.\\nThe team expanded to include Christopher Slowe in November 2005. Between November 2005 and January 2006, Reddit merged with Aaron Swartz\\'s company Infogami, and Swartz became an equal owner of the resulting parent company, Not A Bug. Swartz went on to help rewrite the software running Reddit using web.py, a web framework he developed. The passage from Aaron Swartz\\'s blog post \"Rewriting Reddit\" reveals that the switch from Lisp to Python, specifically using the web.py framework developed by Swartz, was driven by a desire for simplicity, maintainability, and performance. Despite facing skep', metadata={'title': 'Reddit', 'summary': 'Reddit () is an American social news aggregation, content rating, and forum social network. Registered users (commonly referred to as \"Redditors\") submit content to the site such as links, text posts, images, and videos, which are then voted up or down by other members. Posts are organized by subject into user-created boards called \"communities\" or \"subreddits\". Submissions with more upvotes appear towards the top of their subreddit and, if they receive enough upvotes, ultimately on the site\\'s front page. Reddit administrators moderate the communities. Moderation is also conducted by community-specific moderators, who are not Reddit employees. It is operated by Reddit, Inc., based in San Francisco.\\nAs of October 2023, Reddit is the 18th most-visited website in the world. According to data provided by Similarweb, 48.98% of the website traffic comes from the United States, followed by the United Kingdom at 7.06% and Canada at 6.9%.\\nReddit was founded by University of Virginia roommates Steve Huffman and Alexis Ohanian, as well as Aaron Swartz, in 2005. Condé Nast Publications acquired the site in October 2006. In 2011, Reddit became an independent subsidiary of Condé Nast\\'s parent company, Advance Publications. In October 2014, Reddit raised $50 million in a funding round led by Sam Altman and including investors Marc Andreessen, Peter Thiel, Ron Conway, Snoop Dogg, and Jared Leto. Their investment valued the company at $500 million at the time. In July 2017, Reddit raised $200 million for a $1.8 billion valuation, with Advance Publications remaining the majority stakeholder. In February 2019, a $300 million funding round led by Tencent brought the company\\'s valuation to $3 billion. In August 2021, a $700 million funding round led by Fidelity Investments raised that valuation to over $10 billion. The company then reportedly filed for an IPO in December 2021 with a valuation of $15 billion. Reddit debuted on the stock market on the morning of March 21, 2024 with the ticker symbol RDDT.\\nReddit has received praise for many of its features, such as the ability to create several subreddits for niche communities, being a platform for raising publicity for numerous causes, and has grown to be one of the most visited websites on the Internet. It has also received criticism for spreading misinformation.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Reddit'}), Document(page_content='Bret Steven Taylor (born 1980) is an American computer programmer and entrepreneur. He is most notable for leading the team that co-created Google Maps and his tenures as the CTO of Facebook (now Meta Platforms), as the chairman of Twitter, Inc.\\'s board of directors prior to its acquisition by Elon Musk, and as the co-CEO of Salesforce (alongside co-founder Marc Benioff). Taylor was additionally one of the founders of FriendFeed and the creator of Quip. Since 2023, he is chairman of OpenAI and a board member of Shopify.\\n\\n\\n== Early life and education ==\\nTaylor was born in Oakland, California in 1980, primarily growing up in the East Bay. He graduated from Acalanes High School in Lafayette, California in 1998. He attended Stanford University, where he earned his bachelor\\'s and master\\'s degree in computer science in 2002 and 2003, respectively.\\n\\n\\n== Career ==\\nIn 2003, Taylor was hired by Google as an associate product manager. He led the team working on features such as Search by Location and Google Local—predecessors to Google Maps. Taylor left Google in June 2007 to join venture capital firm Benchmark Capital as an entrepreneur-in-residence, where he and several other former Google employees founded the social network web site FriendFeed. Taylor was CEO of FriendFeed until August 2009, when the company was acquired by Facebook for an estimated $50 million. The acquisition led to Facebook adopting the \"Like\" button from FriendFeed. After the acquisition, Taylor joined Facebook and became CTO in 2010.\\nIn 2012, Taylor left Facebook to found Quip, a competitor to Google Docs. Quip was acquired by Salesforce in 2016. That year, Twitter, Inc. announced that Taylor was appointed to their board of directors. In 2021, he became chairman of Twitter. He remained in the position until the entire board of directors was dissolved following the acquisition of Twitter by Elon Musk in October 2022.\\nIn 2017, Taylor was named chief product officer at Salesforce. He was named president and chief operating officer at Salesforce two years later. As COO, Taylor led Salesforce\\'s acquisition of Slack Technologies, which closed in 2021. He also led the creation of a system dubbed Customer 360 at Salesforce and started an associate product manager program at the company. In November 2021, Taylor was named vice chair and co-CEO at Salesforce. On November 30, 2022, it was announced that Taylor would be stepping down as co-CEO and vice chair at Salesforce at the end of January 2023. In February 2023, he co-founded an enterprise-focused artificial intelligence (AI) startup, Sierra.\\nIn November 2023, Taylor replaced Greg Brockman as the chairman of OpenAI when Sam Altman was briefly ousted and reinstated as CEO of the company by its board members. He also serves on the board of Shopify since 2023.\\n\\n\\n== Personal life ==\\nHe married Karen Padham in 2006, whom he met while working at Google. The couple has three children. He is a fan of Stanford football. His father, mother, and older sister also attended Stanford. \\n\\n\\n== References ==\\n\\n\\n== External links ==', metadata={'title': 'Bret Taylor', 'summary': \"Bret Steven Taylor (born 1980) is an American computer programmer and entrepreneur. He is most notable for leading the team that co-created Google Maps and his tenures as the CTO of Facebook (now Meta Platforms), as the chairman of Twitter, Inc.'s board of directors prior to its acquisition by Elon Musk, and as the co-CEO of Salesforce (alongside co-founder Marc Benioff). Taylor was additionally one of the founders of FriendFeed and the creator of Quip. Since 2023, he is chairman of OpenAI and a board member of Shopify.\", 'source': 'https://en.wikipedia.org/wiki/Bret_Taylor'}), Document(page_content='The Disco Biscuits are an American jam band from Philadelphia. The band consists of Allen Aucoin (drums), Marc \"Brownie\" Brownstein  (bass guitar, vocals), Jon \"The Barber\" Gutwillig  (guitar, vocals), and Aron Magner (keyboards, synths, vocals). The band incorporates elements from a variety of musical genres with a base of electronic and rock. Their style has been described as trance fusion.\\n\\n\\n== History ==\\nThe Disco Biscuits formed in 1995 at the University of Pennsylvania. Brownstein, Gutwillig, Magner, and the original drummer, Sam \"Sammy\" Altman, bonded over a shared affinity for psychedelic rock, electronic music, soul, blues, jazz and classical music. This eclectic mix of interests helped inspire their distinctive style of live electronic music, which is sometimes called \\'trance fusion\\'. The term references the band\\'s choice to incorporate elements of trance music - specifically the driving, rhythmically repetitive drum beats and melodic sections that repeat and evolve over time - into the instrumentation and conventions of a live jam-band where guitar, bass, keyboards, and drums play structured songs with sections for exploratory improvisation. \\nThe band honed their style while playing at bars and fraternity-house shows in the Philadelphia area in the mid-1990s. Bassist Marc Brownstein credits the improvisational ingenuity demonstrated by the jam-band Phish during the 95-97 tours as a particular inspiration for the Disco Biscuits\\' unique sound. He recognized that improvisation-inclined bands (largely inspired by Phish and the Grateful Dead) needed to differentiate their sound in meaningful ways in order to stand out in the underground mid-to-late-1990s live music scene, and the Biscuits members\\' interest in electronic music provided an excellent opportunity to explore a unique sound. \\nThe band received particular acclaim from fans during their 1999 tours for the thoughtful setlist compositions mixed with exploratory improvisation. This era (which has been referred to as \\'the nine-nine\\' by Disco Biscuits fans) featured energetic musical improvisation that incorporated new musical elements while still remaining enjoyable to more mainstream jam-band audiences whose tastes tended to gravitate towards folk-rock and blues. \\nThe first inklings of what ultimately became trance-fusion emerged during shows played by the band shortly after keyboardist Aron Magner incorporated a Roland JP-8000 into his live setup in late 1997. This analog-modeling synthesizer (which incidentally also features prominently in the popular track Sandstorm by Finnish electronic artist Darude) supplied sounds that lent a distinctly electronic flavor to jams that were in most other ways typical Phish-inspired blues-rock improvisations. The Halloween 1997 set at the Phi Kappa Gamma fraternity house near the University of Pennsylvania campus is unofficially recognized as the first show that incorporated the JP-8000, helping cement the Biscuits\\' connection to live, improvised electronic music. \\nIn 2005 drummer Sammy Altman left the band to pursue a career in medicine. The band began a search for their next drummer ending with a two-night, sold-out drum-off concert at the Borgata\\'s Music Box in Atlantic City. In December 2005 Allen Aucoin was announced as the newest member of the band. Aucoin knew members of the Biscuits\\' road crew and had opened for the Biscuits in the past. In 2006 the band purchased the Old City Philadelphia studio space that had previously belonged to DJ Jazzy Jeff. The space became a place for local musicians to congregate and work, culminating in the unique collaborations recorded in recording studio efforts known as the Planet Anthem sessions. Around the time Planet Anthem was released, the Biscuits also collaborated with noted hip-hop producer Damon Dash working on a variety of projects.\\n\\n\\n== Camp Bisco ==\\n\\nThe first Camp Bisco took place in August 1999 in Cherrytree Pennsylvania, the band seeking to combine the creative effects of e', metadata={'title': 'Disco Biscuits', 'summary': 'The Disco Biscuits are an American jam band from Philadelphia. The band consists of Allen Aucoin (drums), Marc \"Brownie\" Brownstein  (bass guitar, vocals), Jon \"The Barber\" Gutwillig  (guitar, vocals), and Aron Magner (keyboards, synths, vocals). The band incorporates elements from a variety of musical genres with a base of electronic and rock. Their style has been described as trance fusion.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Disco_Biscuits'}), Document(page_content='Humane, Inc. (stylized as hu.ma.ne) is an American consumer electronics company founded in 2018 by Imran Chaudhri and Bethany Bongiorno. The company designed and developed the Ai Pin, which started shipping in April 2024.\\n\\n\\n== History ==\\nHumane was founded by Imran Chaudhri and Bethany Bongiorno in 2018; the couple previously worked at Apple Inc. The startup emerged from stealth mode in 2021. Chaudhri revealed the device and demonstrated its features during a TED Talk in May 2023, and it was later showcased at Paris Fashion Week in September.\\nBy November 2023, the company had raised $230 million, with notable investors such as Marc Benioff, Sam Altman, Tiger Global, SoftBank, Qualcomm, Microsoft, LG, Volvo, and Salesforce. Microsoft and OpenAI also announced partnerships with Humane.\\nHumane announced their wearable device would be called the \"Ai Pin” in July 2023. The device was formally announced on November 9, 2023, and sales started one week later.\\nThe Humane Ai Pin was featured in Time Magazine\\'s Best 200 Inventions of 2023, published before the product was released and without Time being provided a review unit for testing. Time\\'s co-chairs, Marc and Lynne Benioff, are investors in Humane Inc.\\nIn January 2024, the company laid off 4% of its staff (10 employees). The device began shipping in April 2024.\\n\\n\\n== Reception ==\\nHumane\\'s Ai Pin has received generally negative reviews, praising its product design but criticizing the limited battery life and how easily the device overheats in just a few minutes.\\nThe Verge wrote, \"After many days of testing, the one and only thing I can truly rely on the AI Pin to do is tell me the time.\" The review from Inverse stated that it \" is slow to answer even basic questions.\" Fast Company noted that \"Almost everything about the pin was a UX disaster for reviewers.\"\\nIn response to the criticism, lead Ai Pin engineer Ken Kocienda said that he used the product \"all the time\" but did find it \"frustrating sometimes\" in the same way as a laptop or smartphone.\\n\\n\\n== See also ==\\nQuantified self\\n\\n\\n== References ==', metadata={'title': 'Humane Inc.', 'summary': 'Humane, Inc. (stylized as hu.ma.ne) is an American consumer electronics company founded in 2018 by Imran Chaudhri and Bethany Bongiorno. The company designed and developed the Ai Pin, which started shipping in April 2024.', 'source': 'https://en.wikipedia.org/wiki/Humane_Inc.'}), Document(page_content='Emmett Shear (born 1983) is an American Internet entrepreneur and investor. He is the co-founder of live video platform Justin.tv. He served as the chief executive officer of Twitch when it was spun off from Justin.tv until March 2023. In 2011, Shear was appointed as a part-time partner at venture capital firm Y Combinator. In November 2023, he briefly served as interim CEO of OpenAI.\\n\\n\\n== Early life and education ==\\nEmmett Shear grew up in Seattle, Washington, where he attended the Evergreen School for Gifted Children. There, he met his eventual co-founder Justin Kan at age eight, and the two were bonded by their accelerated math classes and playing Magic: The Gathering. \\nShear studied computer science as an undergraduate student at Yale University. He attended with his eventual Twitch co-founders Justin Kan and Michael Seibel.\\n\\n\\n== Career ==\\n\\n\\n=== Y Combinator ===\\nShear, along with Justin Kan, applied to the first class of Y Combinator when they were seniors in 2005. As part of Y Combinator, the two built a calendar application called Kiko, which they eventually sold on eBay for $250,000 after Google Calendar was introduced.\\n\\n\\n=== Justin.tv ===\\nIn 2006, Shear and Justin Kan, along with Michael Seibel and Kyle Vogt, started Justin.tv, a 24/7 live video feed of Kan\\'s life, broadcast via a webcam attached to his head.\\nKan\\'s \"lifecasting\" lasted about eight months until the four partners decided to transition to providing a live video platform so anyone could publish a live video stream. Launched in 2007, Justin.tv was one of the largest live video platforms in the world with more than 30 million unique users every month until it was shut down on August 5, 2014.\\n\\n\\n=== Twitch ===\\nAfter Justin.tv launched in 2007, the site quickly began building subject-specific content categories like Social, Tech, Sports, Entertainment, News & Events, and Gaming. Gaming, in particular, grew very fast and became the most popular content on the site.\\nIn June 2011, the company decided to spin off the gaming content under a separate brand and site. They named it TwitchTV, inspired by the term twitch gameplay. On August 29, 2011, Shear became CEO of Justin.tv, and remained in that role as the company rebranded around Twitch in 2014, which had quickly became its core product.\\nOn August 25, 2014, Amazon officially acquired Twitch for a reported $970,000,000.\\n\\nIn March 2023, Shear announced that he was resigning as CEO, and that Daniel J. Clancy would take over.\\n\\n\\n=== Investor Activities ===\\nShear became a part-time partner at Y Combinator in June 2011, where he offered advice to the new startups in each batch.\\n\\n\\n=== OpenAI ===\\nOn November 19, 2023, Shear was named as the interim CEO of OpenAI, following the removal of Sam Altman by the board two days earlier. On November 21, an agreement was reached to reinstate Altman as CEO. It was previously reported that Shear had threatened to resign as CEO if the board could not provide evidence to support Altman\\'s removal.\\nShear has publicly stated that he is concerned about the impact AI can have on civilization, putting his “P(Doom)”, or probability of human extinction from AI, at between 5 and 50 percent.\\n\\n\\n== Philanthropy ==\\nIn March 2020, during the COVID-19 pandemic, via Twitch, Shear donated the initial US$1 million to start a SF New Deal, a non-profit organization which ordered meals from San Francisco eateries and delivered them to people in need. The organization was started by his Yale college classmate Leonore Estrada, who owned the Three Babes Bakeshop in San Francisco\\'s Bayview neighborhood.\\n\\n\\n== Notes ==\\n\\n\\n== References ==\\n\\n\\n== External links ==\\nEmmett Shear on Twitter \\nEmmett Shear on Facebook', metadata={'title': 'Emmett Shear', 'summary': 'Emmett Shear (born 1983) is an American Internet entrepreneur and investor. He is the co-founder of live video platform Justin.tv. He served as the chief executive officer of Twitch when it was spun off from Justin.tv until March 2023. In 2011, Shear was appointed as a part-time partner at venture capital firm Y Combinator. In November 2023, he briefly served as interim CEO of OpenAI.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Emmett_Shear'}), Document(page_content='Adam D\\'Angelo (born August 14, 1984) is an American internet entrepreneur. He is best known for his role as the co-founder and CEO of Quora, based in Mountain View, California.\\n\\n\\n== Early life and education ==\\nAdam D\\'Angelo was born on August 14, 1984 in Redding, Connecticut, United States. He attended Phillips Exeter Academy for high school. There, he developed the Synapse Media Player (a music suggestion software) along with Mark Zuckerberg and others.\\nFrom 2002 to 2006, he attended California Institute of Technology, where he graduated with a B.S. in Computer Science.\\n\\n\\n== Career ==\\nIn 2004, while attending college, D\\'Angelo also created the website BuddyZoo, which allowed users to upload their AIM buddy list and compare them with those of other users. The service also generated graphs based on the buddy lists.\\nD\\'Angelo joined Facebook shortly after its launch in 2004, and served as its chief technology officer (CTO) from 2006 to 2008, and also served as its vice president of engineering, until 2008. \\nIn June 2009, he started Quora. In May 2012, he invested $20 million of his own money into Quora as part of their Series B round of financing. Apart from Quora, his notable investments include Instagram before its acquisition by Facebook for $1 billion, Asana, a work management platform co-founded by Facebook co-founder, Dustin Moskovitz, and Lunchclub, a networking platform using artificial intelligence.\\nD\\'Angelo is also the founder of an AI startup, Poe.\\n\\n\\n=== Other work ===\\nD\\'Angelo was an advisor to and investor in Instagram before its acquisition by Facebook in 2012.\\nIn 2018, he joined the board of directors of OpenAI. In 2023, D\\'Angelo voted to remove Sam Altman from his role as CEO of OpenAI. When Sam Altman returned to OpenAI, the other three board members involved in Altman\\'s ouster resigned. D\\'Angelo retained his position making him the only one of the six board members on the eve of the ouster still in office.\\n\\n\\n== Honors and achievements ==\\nIn 2001, he was placed eighth at the USA Computing Olympiad as a high school student and he won a silver medal at the 2002 International Olympiad in Informatics.\\nACM International Collegiate Programming Contest (ICPC): California Institute of Technology Beavers (team of 3), World Finalists 2003, 2004; North American Champions 2003; World Finals Silver Medals 2004; World Finals co-coach 2005.\\nIn 2005, he was one of the top 24 finalists in the Algorithm Coding Competition of the Topcoder Collegiate Challenge.\\nFortune magazine included D\\'Angelo as runner-up in its \"Smartest people in tech\" article in 2010.\\n\\n\\n== References ==', metadata={'title': \"Adam D'Angelo\", 'summary': \"Adam D'Angelo (born August 14, 1984) is an American internet entrepreneur. He is best known for his role as the co-founder and CEO of Quora, based in Mountain View, California.\", 'source': 'https://en.wikipedia.org/wiki/Adam_D%27Angelo'}), Document(page_content=\"Jessica Livingston (born 1971) is an American founding partner of the seed stage venture firm Y Combinator and author. She is the wife of founding partner Paul Graham.\\n\\n\\n== Early life and education ==\\nLivingston grew up in the Boston area. In 1989, she graduated from Phillips Academy. She received a Bachelor of Arts with a major in English from Bucknell University.\\n\\n\\n== Investing ==\\nPrior to founding Y Combinator, Livingston was vice president of marketing at Adams Harkness Financial Group.\\nLivingston met Paul Graham, Robert Morris and Trevor Blackwell (the co-founders of dot-com company Viaweb) at a party in Cambridge. They discussed creating a startup incubator and in 2005 the four co-founded Y Combinator. In the early days of YC, Livingston and Graham hosted weekly meals for their founders at their home near Cambridge. Sam Altman (a former YC partner) credits Livingston with being essential to the transformation of Y Combinator into a startup ecosystem. When Graham stepped down from his role leading Y Combinator, handing over to Altman, Livingston increased her day to day involvement, including having responsibility for the organisation's Startup School.\\nIn 2016, she took a year-long sabbatical from the incubator, to spend time with her family and consider projects and other things she wanted to pursue.\\nIn early 2007, Livingston published Founders at Work: Stories of Startups' Early Days, a collection of interviews with famous startup founders, including Steve Wozniak.\\nIn 2013, Livingston launched the Female Founders conference with the aim of inspiring more women to found startup companies.\\nLivingston is one of the financial backers of OpenAI, a for-profit company aimed at the safe development of artificial general intelligence.\\n\\n\\n== Career ==\\nIn 2023, she started co-hosting The Social Radars Podcast alongside Carolyn Levy.\\n\\n\\n== Personal life ==\\nLivingston married Paul Graham in 2008. Since late 2016, she and her family have resided in the United Kingdom.\\n\\n\\n== References ==\", metadata={'title': 'Jessica Livingston', 'summary': 'Jessica Livingston (born 1971) is an American founding partner of the seed stage venture firm Y Combinator and author. She is the wife of founding partner Paul Graham.', 'source': 'https://en.wikipedia.org/wiki/Jessica_Livingston'}), Document(page_content=\"Dario Amodei (born 1983) is an Italian-American artificial intelligence researcher and entrepreneur. He is the co-founder and CEO of Anthropic, the company behind the large language model series Claude AI. He was the former vice president of research at OpenAI.\\n\\n\\n== Education ==\\nAmodei began his undergraduate studies at Caltech, where he worked with Tom Tombrello as one of Tombrello's Physics 11 students. He later transferred to Stanford University, where he earned his undergraduate degree in physics. He also holds a PhD in physics from Princeton University. He was a postdoctoral scholar at the Stanford University School of Medicine.\\n\\n\\n== Career ==\\nFrom November 2014 until October 2015 he worked at Baidu. After that, he worked at Google. In 2016, Amodei joined OpenAI.\\nIn 2021, Amodei and his sister Daniela founded Anthropic along with other former senior members of OpenAI. The Amodei siblings were among those who left OpenAI due to directional differences, specifically regarding OpenAI's ventures with Microsoft in 2019.\\nIn July 2023, Amodei warned a United States Senate judiciary panel of the dangers of AI, including the risks it poses in the development and control of weaponry.\\nIn September 2023, Amodei and his sister Daniela were named as two of the TIME 100 Most Influential People in AI (TIME100 AI).\\nIn November 2023, the board of directors of OpenAI approached Amodei about replacing Sam Altman and potentially merging the two startups. Amodei declined both offers.\\n\\n\\n== References ==\\n\\n\\n== External links ==\\nNYTimes podcast with Dario Amodei\", metadata={'title': 'Dario Amodei', 'summary': 'Dario Amodei (born 1983) is an Italian-American artificial intelligence researcher and entrepreneur. He is the co-founder and CEO of Anthropic, the company behind the large language model series Claude AI. He was the former vice president of research at OpenAI.', 'source': 'https://en.wikipedia.org/wiki/Dario_Amodei'}), Document(page_content='Within the LGBT community, there are 12 known billionaires. As of 2015, the Italian fashion designer Giorgio Armani is the richest person in the community (according to the LGBT-interest magazine The Advocate.)\\n\\n\\n== History ==\\nIn 1980, the DreamWorks co-founder David Geffen came out as the first openly bisexual billionaire in the world. He had wanted to date women before such as Cher, but finally came to realise his sexuality in the early 1980s and had become one of the most important forces in the gay rights movement by 1992.\\nGiorgio Armani is known for being notoriously private and has remained relatively quiet about his own sexuality. The Sunday Times speculates he has remained quiet on the subject out of fear sales of Armani might decline in Asia if he officially came out. However, in 2000 he told Vanity Fair, \"I have had women in my life. And sometimes men.\"\\nOn 16 August 2013, Jennifer Pritzker made headlines by announcing that she identifies herself as a woman for all business and personal undertakings. This announcement made Pritzker the world\\'s first openly transgender billionaire. In October 2015, Norway\\'s second richest billionaire Stein Erik Hagen came out as bisexual on the Norwegian talk show Skavlan.\\n\\n\\n== List ==\\n\\n\\n== See also ==\\nLists of billionaires\\nBlack billionaires\\nList of countries by the number of billionaires\\n\\n\\n== References ==', metadata={'title': 'LGBT billionaires', 'summary': 'Within the LGBT community, there are 12 known billionaires. As of 2015, the Italian fashion designer Giorgio Armani is the richest person in the community (according to the LGBT-interest magazine The Advocate.)', 'source': 'https://en.wikipedia.org/wiki/LGBT_billionaires'}), Document(page_content='ChatGPT is a chatbot developed by OpenAI and launched on November 30, 2022. Based on large language models (LLMs), it enables users to refine and steer a conversation towards a desired length, format, style, level of detail, and language. Successive user prompts and replies are considered at each conversation stage as context.\\nChatGPT is credited with starting the AI boom, which has led to ongoing rapid and unprecedented investment in and public attention to the field of artificial intelligence. By January 2023, it had become what was then the fastest-growing consumer software application in history, gaining over 100 million users and contributing to the growth of OpenAI\\'s current valuation of $80 billion. ChatGPT\\'s release spurred the release of competing products, including Gemini, Ernie, LLaMA, Claude, and Grok. Microsoft launched Copilot, based on OpenAI\\'s GPT-4. Some observers raised concern about the potential of ChatGPT and similar programs to displace or atrophy human intelligence, enable plagiarism, or fuel misinformation.\\nChatGPT is built on OpenAI\\'s proprietary series of generative pre-trained transformer (GPT) models and is fine-tuned for conversational applications using a combination of supervised learning and reinforcement learning from human feedback. ChatGPT was released as a freely available research preview, but due to its popularity, OpenAI now operates the service on a freemium model. Users on its free tier can access the GPT-3.5-based version, while the more advanced GPT-4 and other features are released under the \"ChatGPT Plus\" paid subscription service.\\n\\n\\n== Training ==\\nChatGPT is based on particular GPT foundation models, namely GPT-3.5 and GPT-4, that were fine-tuned to target conversational usage. The fine-tuning process leveraged supervised learning and reinforcement learning from human feedback (RLHF). Both approaches employed human trainers to improve model performance. In the case of supervised learning, the trainers played both sides: the user and the AI assistant. In the reinforcement learning stage, human trainers first ranked responses that the model had created in a previous conversation. These rankings were used to create \"reward models\" that were used to fine-tune the model further by using several iterations of proximal policy optimization.\\nTime magazine revealed that, to build a safety system against harmful content (e.g., sexual abuse, violence, racism, sexism), OpenAI used outsourced Kenyan workers earning less than $2 per hour to label harmful content. These labels were used to train a model to detect such content in the future. The outsourced laborers were exposed to \"toxic\" and traumatic content; one worker described the assignment as \"torture\". OpenAI\\'s outsourcing partner was Sama, a training-data company based in San Francisco, California.\\nChatGPT initially used a Microsoft Azure supercomputing infrastructure, powered by Nvidia GPUs, that Microsoft built specifically for OpenAI and that reportedly cost \"hundreds of millions of dollars\". Following ChatGPT\\'s success, Microsoft dramatically upgraded the OpenAI infrastructure in 2023. Scientists at the University of California, Riverside, estimate that a series of prompts to ChatGPT needs approximately 500 milliliters (18 imp fl oz; 17 U.S. fl oz) of water for Microsoft servers cooling. TrendForce market intelligence estimated that 30,000 Nvidia GPUs (each costing approximately $10,000–15,000) were used to power ChatGPT in 2023.\\nOpenAI collects data from ChatGPT users to train and fine-tune the service further. Users can upvote or downvote responses they receive from ChatGPT and fill in a text field with additional feedback.\\nChatGPT\\'s training data includes software manual pages, information about internet phenomena such as bulletin board systems, multiple programming languages, and the text of Wikipedia.\\n\\n\\n== Features and limitations ==\\n\\n\\n=== Features ===\\nAlthough a chatbot\\'s core function is to mimic a human conversationalist, Chat', metadata={'title': 'ChatGPT', 'summary': 'ChatGPT is a chatbot developed by OpenAI and launched on November 30, 2022. Based on large language models (LLMs), it enables users to refine and steer a conversation towards a desired length, format, style, level of detail, and language. Successive user prompts and replies are considered at each conversation stage as context.\\nChatGPT is credited with starting the AI boom, which has led to ongoing rapid and unprecedented investment in and public attention to the field of artificial intelligence. By January 2023, it had become what was then the fastest-growing consumer software application in history, gaining over 100 million users and contributing to the growth of OpenAI\\'s current valuation of $80 billion. ChatGPT\\'s release spurred the release of competing products, including Gemini, Ernie, LLaMA, Claude, and Grok. Microsoft launched Copilot, based on OpenAI\\'s GPT-4. Some observers raised concern about the potential of ChatGPT and similar programs to displace or atrophy human intelligence, enable plagiarism, or fuel misinformation.\\nChatGPT is built on OpenAI\\'s proprietary series of generative pre-trained transformer (GPT) models and is fine-tuned for conversational applications using a combination of supervised learning and reinforcement learning from human feedback. ChatGPT was released as a freely available research preview, but due to its popularity, OpenAI now operates the service on a freemium model. Users on its free tier can access the GPT-3.5-based version, while the more advanced GPT-4 and other features are released under the \"ChatGPT Plus\" paid subscription service.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/ChatGPT'}), Document(page_content='Grok is a generative artificial intelligence chatbot developed by xAI, based on a large language model (LLM). It was developed as an initiative by Elon Musk as a direct response to the rise of OpenAI\\'s ChatGPT which Musk co-founded. The chatbot is advertised as \"having a sense of humor\" and direct access to Twitter (X). It is currently under beta testing for those with the premium version of X.\\n\\n\\n== Background ==\\nMusk co-founded the AI research organization OpenAI with Sam Altman in 2015. Musk left the company\\'s board in 2018, saying of his decision that he \"didn\\'t agree with some of what OpenAI team wanted to do\". OpenAI went on to launch ChatGPT in 2022, and GPT-4 in March 2023. That month, Elon Musk was one of individuals to sign an open letter from the Future of Life Institute calling for a six-month pause in the development of any AI software more powerful than GPT-4.\\nIn April 2023, Elon Musk said in an interview on Tucker Carlson Tonight that he intended to develop an AI chatbot called \"TruthGPT\", which he described as \"a maximum truth-seeking AI that tries to understand the nature of the universe\". He expressed concern to Carlson that ChatGPT was being \"trained to be politically correct\".\\nTruthGPT would later become known as \"Grok\", a verb coined by Robert A. Heinlein in his 1961 science-fiction novel Stranger in a Strange Land to describe a form of understanding.\\nIn December 2023 the Silicon Valley start-up Curio launched a range of AI-powered children\\'s toys, including a rocket-shaped character named Grok. The toy is voiced by Musk\\'s ex-girlfriend Grimes, who is also an investor in the start-up, but the product is unrelated to the xAI service.\\n\\n\\n== History ==\\nIn November 2023, xAI began previewing Grok as a chatbot to selected people, with participation in the early access program being limited to paid X Premium users. It was announced that once the bot was out of early beta, it would only be available to higher tier X Premium+ subscribers. At the time of the preview, xAI described the chatbot as \"a very early beta product – the best we could do with 2 months of training\" that could \"improve rapidly with each passing week\".\\nOn March 11, 2024, Musk posted on X that the language model would go open source within a week and six days later, on March 17, Grok became open source.\\nOn March 17, 2024, Grok-1 was open sourced under the Apache-2.0 license.\\nOn March 26, 2024, Musk announced that Grok would be enabled for all premium subscribers, not just those on the higher-end tier, Premium+.\\nOn March 29, 2024, Grok-1.5 was announced, with \"improved reasoning capabilities\" and a context length of 128,000 tokens. \\nOn April 4, 2024, an update to X\\'s \"Explore\" page included summaries of breaking news stories written by Grok, a task previously assigned to a human curation team. When a large number of verified users began to spread false stories about Iran having attacked Israel on April 4 (nine days before the 2024 Iranian strikes in Israel), Grok treated the story as real and created a headline and paragraph-long summary of the event. Days later it reacted to many users joking about the solar eclipse with the summarized headline \"Sun\\'s Odd Behavior: Experts Baffled\".\\nOn April 12, 2024, Grok-1.5 Vision (Grok-1.5V) was announced. Grok-1.5V is able to process a wide variety of visual information, including documents, diagrams, graphs, screenshots, and photographs.\\n\\n\\n== Features ==\\nAn xAI statement described the chatbot as having been designed to \"answer questions with a bit of wit\" and as having \"a rebellious streak\", as well as a willingness to \"answer spicy questions that are rejected by most other AI systems\". It said that bot had been \"modeled after The Hitchhiker\\'s Guide to the Galaxy, so intended to answer almost anything\".\\nAn extract shared by an X employee showed Grok being asked to answer the question \"When is it appropriate to listen to Christmas music?\" in a vulgar manner, and responding \"whenever the hell you want\" and add', metadata={'title': 'Grok (chatbot)', 'summary': 'Grok is a generative artificial intelligence chatbot developed by xAI, based on a large language model (LLM). It was developed as an initiative by Elon Musk as a direct response to the rise of OpenAI\\'s ChatGPT which Musk co-founded. The chatbot is advertised as \"having a sense of humor\" and direct access to Twitter (X). It is currently under beta testing for those with the premium version of X.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Grok_(chatbot)'}), Document(page_content='Generative Pre-trained Transformer 3 (GPT-3) is a large language model released by OpenAI in 2020. Like its predecessor, GPT-2, it is a decoder-only transformer model of deep neural network, which supersedes recurrence and convolution-based architectures with a technique known as \"attention\". This attention mechanism allows the model to selectively focus on segments of input text it predicts to be most relevant. It uses a 2048-tokens-long context, float16 (16-bit) precision, and a hitherto-unprecedented 175 billion parameters, requiring 350GB of storage space as each parameter takes 2 bytes of space, and has demonstrated strong \"zero-shot\" and \"few-shot\" learning abilities on many tasks.\\nOn September 22, 2020, Microsoft announced that it had licensed GPT-3 exclusively. Others can still receive output from its public API, but only Microsoft has access to the underlying model.\\n\\n\\n== Background ==\\nAccording to The Economist, improved algorithms, more powerful computers, and a recent increase in the amount of digitized material have fueled a revolution in machine learning. New techniques in the 2010s resulted in \"rapid improvements in tasks”, including manipulating language.\\nSoftware models are trained to learn by using thousands or millions of examples in a \"structure ... loosely based on the neural architecture of the brain\". One architecture used in natural language processing (NLP) is a neural network based on a deep learning model that was introduced in 2017—the transformer architecture. There are a number of NLP systems capable of processing, mining, organizing, connecting and contrasting textual input, as well as correctly answering questions.\\nOn June 11, 2018, OpenAI researchers and engineers published a paper introducing the first generative pre-trained transformer (GPT)—a type of generative large language model that is pre-trained with an enormous and diverse text corpus in datasets, followed by discriminative fine-tuning to focus on a specific task. GPT models are transformer-based deep-learning neural network architectures. Previously, the best-performing neural NLP models commonly employed supervised learning from large amounts of manually-labeled data, which made it prohibitively expensive and time-consuming to train extremely large language models. The first GPT model was known as \"GPT-1,\" and it was followed by \"GPT-2\" in February 2019. Created as a direct scale-up of its predecessor, GPT-2 had both its parameter count and dataset size increased by a factor of 10. It had 1.5 billion parameters, and was trained on a dataset of 8 million web pages. \\nIn February 2020, Microsoft introduced its Turing Natural Language Generation (T-NLG), which they claimed was \"largest language model ever published at 17 billion parameters.\" It performed better than any other language model at a variety of tasks, including summarizing texts and answering questions.\\n\\n\\n== Training and capabilities ==\\n\\nOn May 28, 2020, an arXiv preprint by a group of 31 engineers and researchers at OpenAI described the achievement and development of GPT-3, a third-generation \"state-of-the-art language model\". The team increased the capacity of GPT-3 by over two orders of magnitude from that of its predecessor, GPT-2, making GPT-3 the largest non-sparse language model to date.:\\u200a14\\u200a Because GPT-3 is structurally similar to its predecessors, its greater accuracy is attributed to its increased capacity and greater number of parameters. GPT-3\\'s capacity is ten times larger than that of Microsoft\\'s Turing NLG, the next largest NLP model known at the time.\\nLambdalabs estimated a hypothetical cost of around $4.6 million US dollars and 355 years to train GPT-3 on a single GPU in 2020, with lower actual training time by using more GPUs in parallel.\\nSixty percent of the weighted pre-training dataset for GPT-3 comes from a filtered version of Common Crawl consisting of 410 billion byte-pair-encoded tokens.:\\u200a9\\u200a Other sources are 19 billion tokens from WebText2 represent', metadata={'title': 'GPT-3', 'summary': 'Generative Pre-trained Transformer 3 (GPT-3) is a large language model released by OpenAI in 2020. Like its predecessor, GPT-2, it is a decoder-only transformer model of deep neural network, which supersedes recurrence and convolution-based architectures with a technique known as \"attention\". This attention mechanism allows the model to selectively focus on segments of input text it predicts to be most relevant. It uses a 2048-tokens-long context, float16 (16-bit) precision, and a hitherto-unprecedented 175 billion parameters, requiring 350GB of storage space as each parameter takes 2 bytes of space, and has demonstrated strong \"zero-shot\" and \"few-shot\" learning abilities on many tasks.\\nOn September 22, 2020, Microsoft announced that it had licensed GPT-3 exclusively. Others can still receive output from its public API, but only Microsoft has access to the underlying model.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/GPT-3'}), Document(page_content=\"The 2023 Bilderberg Conference or Bilderberg Club was held between May 18–21, 2023 at the Pestana Palace hotel in Lisbon, Portugal. The 2023 meeting was the 69th edition of the event. A Bilderberg Group press release stated that there were approximately 130 participants from 23 countries.\\nEstablished in 1954 by Prince Bernhard of the Netherlands, Bilderberg conferences (or meetings) are an annual private gathering of the European and North American political and business elite. Events are attended by between 120 and 150 people each year invited by the Bilderberg Group's steering committee; including prominent politicians, CEOs, national security experts, academics and journalists.\\nThe 2023 conference received some media attention due to the participation of several major players in the artificial intelligence space, such as OpenAI CEO Sam Altman, Microsoft CEO Satya Nadella, Google DeepMind chief Demis Hassabis and former Google CEO Eric Schmidt.\\nBilderberg conferences operate under Chatham House rules, meaning that participants are sworn to secrecy and cannot disclose the identity or affiliation of any particular speaker. There were no press conferences during or after the event, as is customary. According to The Guardian, the paper's journalists were able to approach one high-ranking attendee, economist Victor Halberstadt, in a Lisbon pharmacy, but he denied his identity before jumping into a car and heading back to his hotel.\\n\\n\\n== Agenda ==\\nThe key topics for discussion at the 2023 Bilderberg Conference were announced on the Bilderberg website shortly before the meeting. These topics included:\\n\\n\\n== Participants ==\\nA list of 127 participants was published on the Bilderberg website. This list may not be complete, as a source connected to the Bilderberg group told The Daily Telegraph in 2013 that some attendees do not have their names publicized. Oscar Stenström, Sweden’s chief negotiator for NATO membership, was reported to have been seen at the venue despite his name not being on the list.\\n\\n\\n== References ==\", metadata={'title': '2023 Bilderberg Conference', 'summary': \"The 2023 Bilderberg Conference or Bilderberg Club was held between May 18–21, 2023 at the Pestana Palace hotel in Lisbon, Portugal. The 2023 meeting was the 69th edition of the event. A Bilderberg Group press release stated that there were approximately 130 participants from 23 countries.\\nEstablished in 1954 by Prince Bernhard of the Netherlands, Bilderberg conferences (or meetings) are an annual private gathering of the European and North American political and business elite. Events are attended by between 120 and 150 people each year invited by the Bilderberg Group's steering committee; including prominent politicians, CEOs, national security experts, academics and journalists.\\nThe 2023 conference received some media attention due to the participation of several major players in the artificial intelligence space, such as OpenAI CEO Sam Altman, Microsoft CEO Satya Nadella, Google DeepMind chief Demis Hassabis and former Google CEO Eric Schmidt.\\nBilderberg conferences operate under Chatham House rules, meaning that participants are sworn to secrecy and cannot disclose the identity or affiliation of any particular speaker. There were no press conferences during or after the event, as is customary. According to The Guardian, the paper's journalists were able to approach one high-ranking attendee, economist Victor Halberstadt, in a Lisbon pharmacy, but he denied his identity before jumping into a car and heading back to his hotel.\\n\\n\", 'source': 'https://en.wikipedia.org/wiki/2023_Bilderberg_Conference'}), Document(page_content=\"\\n== Advertising and public relations ==\\n\\n\\n== Aerospace ==\\n\\nHenry Crown (1896–1990), founder of the Material Service Corporation (merged with General Dynamics)\\nJesse Itzler (1968–), co-founder of NetJets and co-owner of NBA's Atlanta Hawks\\nAbraham Karem (1937–), Iraqi-born founder of Karem Aircraft\\nSi Ramo (1913–2016), co-founder of TRW Inc.\\nBernard L. Schwartz (1925–2024), long-time CEO of Loral Space & Communications\\nAl Schwimmer (1917–2011), American-Israeli founder of Israel Aerospace Industries\\n\\n\\n== Cosmetics ==\\n\\n\\n== Energy and mining ==\\n\\nGuma Aguiar (1977–2015), Brazilian-born energy industrialist, co-founder of Leor Energy L.P.; disappeared in June 2012\\nArthur Belfer (1906–1993), Polish-born founder of the Belco Petroleum Company, one of the precursor companies of Enron Corporation\\nLouis Blaustein (1869–1937), Lithuanian-born co-founder (along with his son Jacob) of the American Oil Company (1922)\\nJacob Blaustein (1892–1970), American-born co-founder (along with his father Louis) of the American Oil Company (1922)\\nMarvin Davis (1925–2004), chairman of the Davis Petroleum Corp., briefly owner of 20th Century Fox and the Beverly Hills Hotel; member of the Davis family\\nMax Fisher (1908–2005), founder of the Aurora Gasoline Company, once one of the largest gas station chains in the Midwest\\nRobert Friedland (1950–), American-Canadian co-founder of Ivanhoe Energy Inc. and chairman of Ivanhoe Mines Ltd.\\nAvram Glazer (1960–), former chairman and CEO of Zapata Corp. (now HRG Group, Inc.), co-chairman of family-owned EPL's Manchester United F.C.; member of the Glazer family\\nJoseph S. Gruss (1903–1993), Ukrainian-born founder of Gruss & Company\\nJack J. Grynberg (1932–2021), Polish-born oil and natural gas developer, founder of Oceanic Exploration Co.\\nMeyer Guggenheim (1828–1905), Swiss-born mining magnate; member of the Guggenheim family\\nArmand Hammer (1898–1990), long-time CEO and president of the Occidental Petroleum Corporation, co-founder of Isramco\\nLeon Hess (1914–1999), founder of Hess Corporation and former owner of NFL's New York Jets\\nLudwig Jesselson (1910–1993), German-born metal trader who served as president and CEO of Phibro\\nAdolph (1849–1938) and Leonard Lewisohn (1847–1902), German-born mining magnates, founders of Lewisohn Bros.\\nGeorge Lindemann (1936–2018), chairman and CEO of the Southern Union Company\\nBenedict I. Lubell (1909–1996), founder of the Lubell Oil Company\\nSamuel Newhouse (1853–1930), mining magnate; developed Newhouse, Utah\\nAndrew Perlman (1975–), co-founder of GreatPoint Energy\\nSamuel Ruben (1900–1988), co-founder of Duracell Inc.\\nCharles Schusterman (1935–2000), Russian-born founder of the Samson Investment Company\\n\\n\\n== Financial services ==\\n\\n\\n== Food ==\\n\\n\\n== Manufacturing and distribution ==\\n\\n\\n== Miscellaneous ==\\n\\nJuval Aviv (1947–), Israeli-American founder of corporate investigations firm Interfor International\\nLarry Baer, CEO of MLB's San Francisco Giants\\nHenry (1922–2019) and Richard Bloch (1926–2004), founders of tax preparation company H&R Block, Inc.\\nAl Davis (1929–2011), owner of the NFL's Oakland Raiders\\nHeidi Fleiss (1965–), former madam, owner of the Nevada-based Flying S Ranch Ultralight Flightpark, an ultralight private use airport\\nOrit Gadiesh (1951–), Israeli-American corporate strategist, chairwoman of global management consultancy Bain & Company\\nJonathan Greenstein (1967–), founder of auction house J. Greenstein & Company\\nAmi James (1972–), Israeli-American entrepreneur, owner of the Miami-based Love Hate Tattoo Studio, and nightclub Love Hate Lounge\\nJules Kroll (1941–), founder of corporate investigation firm Kroll, Inc.\\nTerry Lenzner (1939–2020), founder of Investigative Group International (IGI)\\nJason Levien, co-owner of D.C. United Holdings (holds MLS' D.C. United), co-owner of EFL Championship's Swansea City A.F.C. and NBL Australia's Brisbane Bullets, former CEO of NBA's Memphis Grizzlies\\nIra A. Lipman (1940–2019), founder and chairman of security company Guardsmark\\nMoishe Man\", metadata={'title': 'List of Jewish American businesspeople', 'summary': '', 'source': 'https://en.wikipedia.org/wiki/List_of_Jewish_American_businesspeople'})]\n"
     ]
    }
   ],
   "source": [
    "from langchain.document_loaders import WikipediaLoader\n",
    "query = \"Sam Altman\"\n",
    "pages = WikipediaLoader(query=query).load()\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5. YouTube Transcript Loader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Document(page_content=\"hey wison yeah what is knowledge craft do we need it to enhance our LM performance oh and also do you know how to integrate it with L chain okay guys hold on take it easy I will explain to you in detail step by step stuff from the per and how to set up our Na 4y databas and then how to integrate it using L chain and of course all of that we will use an open source all app so without further ado let get started what is no squas Once Upon a Time way back in 1736 there was a sweet M named Leonard eer who faced a mindbending challenge the seven breach of kbur problem is there a way to walk across all bries ones starting and ending at the same place eer heis something more crucial what matter was how things were connected so you turn the city's lanmark into dots or nodes and its preaches into lives for ages creating a neat little Network known as the origin of the graph Theory story time is both for SP hold on instead of just buing about landmarks and Brides now Las thing be so he mention notes as to the adjective such as people buildings schools bands and many more and that the ages as the relationship B them for example there is ammy working at a bank and chatting away in Mand now house and Brian also B bound who loves fried R oh there's also an Brian's friend who is btic for fried R too and also FL in Mandarin sounds a bit Tangled right but look at the graph we have got suddenly all starts to make SS now with the idea of notes and ages and the team in relationship with this VRA hey let's get our world is not just a and Amy and Brian it's not just about B and fr price too right so it's a fast thrill of people teams ads and all of those have this special relationship and that's what we call as a knowledge craft so once again knowledge craft is a network of real world entities and and illustrates the relationship between them over we store the no scub in a graph database such as na Forge database and process it using cyber query language n cyber query language includes claes like use match read rer and more you can delve into them further with this new 4G chit now let's talk about how ncft EMP powering alen so using a noge graph you can identify the links even Sly disconnected C what do it means so February 2024 researchers from Microsoft conducted a research to compare Bas retrieval out Meed generon system or rack and graph rack danus filot incident information for a news article data set and the posit questions what has no forus yet done the result baseland white not able to answer it because sometimes using factor is not was a facted especially when the query does not provide enough context about its true intent or when the context is fragment across large corus of tax you probably have hearded about Plus in the middle things and that's the problem and they Pro that gra able to answer this questions because first the about entities which has no FIA this allows the El them to gr itself and then provide a fair to answer in November 2023 there is also a resarch that show how noge gra optimize the SE in a SQL database the researchers revealed that question answering using gbd4 with zero shut problems directly on SQL database achieves an accuracy of 16% notably this accuracy increases 54% when questions are posed over a Knowledge Graph representation on the Enterprise SQL database okay so that's the reason why learn knowledge SC our LM is very interesting and important and before we go into code it's better for us to understand how it works so first in here we will get the user question and then we'll pass this user question to our LM in this TP our LM will also receive a database schema database schema means like the entities and relationship that we already Store to our new forg database and the whole process in here we call it as the graph chain and then from the graph team it will generate a cyber query and then we will run the Cyber query to our new for database to get a result and the result we will pass it to the LM in here the LM will pass the result we create result into our final answer and this St we will get the final one okay th the Cod so actually all the code the data I've already provided in this GitHub and I already put it in the description so the first thing that we need to do is just to clone this so just copy and then go to our FAS code and do K Club here okay guys what stand our next St will be creating a virtual environment so just go to our folder and then do pip install it this it will take a few seconds so I will skip this part now let's open the notep that we have in here so since three already installed all the buttons they from the install that we've just done before so let's run this one so in here all go say we going to use open source L which is the Gemini and then having face and also near so I'll go work on how to get the API for all this but before that we need to cre F to sa B variable and just do this the Google API key so just go over this URL and then or create API if you can have it and for Hing face just follow this link and then use new token but since I already have this tokens so just copy and then save our envirment fre aable and for near forg actually can use my near forg desktop or for this I'll use near hour is uh little simpler so if you don't have a con you should sign up in here okay so the instant is ready and now like click open okay so in here we have the connection URL in here we have the database user and also password make sure to also copy the connection URL and the database username to the environment variable the file so right next is copy paste the password and like connect now the database is connect connected and now the next test is how to connect the python in here to the our database in n4g so actually lch ready provide us with a very simple connector which is this one lch Comm manity to C na for C here so just click run it's all done okay guys so we have done to set up everything so now let's talk about the data itself so the data that we will use in here I will keep it simple we won process a data from the unstructured format such as the PDF the text file no but in here we will use from data from Koo so that is for Manus Kumar for providing this data set so basically is a Linkin data set at professional information like the me the CP and and caring company that they work in the position and many more and actually year we did a little bit preprocessing to finally get this final data the next thing is how to insert this data to na for database so as you can see here says our data in na forg is still empty to know zero and the relationship zero and you can also check it by run to cell you can in here there's nothing in here so how to input it so the first thing that in here is by using the Cyber query to interact with our databit now I'll explain one by one startop from here load CSV with headers from blah blah blah blah so actually it's loading the CSV file from this gith repository and then as R me file for each row and in here is a cyber query inside so we known that okay in here name is the entity of name is person so we make it to Define The Entity that we have in our database so here it's a little bit different with the previous one right so basically we use for is because if you see in the language in here sometimes one people speaks man languages such as Roberto Mira he can speaks English Italian France Dutch and German so here we separate with this s and this line is talking about the relationship if you don't remember about the explanation about relationship entity so this one is the relationship or the ages just run this one okay and let's check it okay so now our data is already in the Nao forg database and check once again let's reload this okay see now we have the company now we have ocated at Country industrial language all the data in from CSP is already imputed in our NE for okay guys now let's talk about the most interesting part of this video how to operate the light L model to interact with our knowledge gra in NE so here we are using chap Google generative AI German Pro open source and then the API can here is the parameter that we have saved if we in file and in here we set the temporate to zero the question is why do you not set it to 0.5 or 0.9 the reason is because in this test we need the LM not to do a creative writing but we needed to translate the natural language to a cyber query language and then here the chain with the chain with graph cyber Q L has provided very easy to use so the graph is the graph that we have defining here and LM is the model that we want to use and for both I set it to close through what does it mean because I want to understand what happened Beyond LOL so right to and then in here we have several questions I've already created a table that contains a pair of the question and the correct answer so it becomes easier for us to check whether the answer resulted from the LM is correct or not we want to know how it's perform so let's run it okay that's cool okay so now let's talk how about result so the first questions L companies and advertising Serv industry in here it gener that cyber Under full contacts is said and J is Tob creative B advertising that's perfect and the second question is a working graduated from cyber FR University is currently employed at okay I'm not sure why but the J cyber query in here look a bit messy and that's why there's a no in the Contex are the result is I do not have the information we filed here and then the third question where is Power LS working okay so sure the J cyber query is correct and the full contact in here tobox cre if this is correct but I don't sure why the Finish Ching here IEM at the answer the four questions we see po here which actually if you remember about the schema of our database the relationship there's no spoken in in our database right so that's why it's no and I didn't have that information the last one is okay problem is the same is not actually it's kind of hting about relationship by the properties by entities right because we don't have relationship is native of in our schema so that's why it's also wrong the answer is zero the correct answer is one now let's do quick recap the result that we have got before so here we have two correct answer and three false answer from the elet right and from this result we can identify some problems the first one is not being able to accurately translate text into a cyber query and the second one is hallucinates properties relationship and entities this one is one of the biggest problems in llm in generating a cyber query so what's the solution we called it as prompting strategies so in short we provide examples to our model to help it understand the structure correctly similar to how parents guide us when we learn to work right more examples makes the models learns and smarter now let's jump to code so the first thing that we need to do is to create pairs of question and sever query so I do it manually just copy this and paste the jity okay once we got a result so just copy and paste it to our psod for example in here I want to copy this questions and the most important part is to treat attack once again if the jtic query from the jity is already not we can do this by going to our new copy paste and check okay good we have this the C queries right just do all that and copy ping here the last thing that you need to do is to add places in here because if you don't do it you I've already have this one so I won't use it I'll use mine to this friends and in here actually langin already provide us with a f shot prom template and so prom template this is the problem that we want to use that we use as a parameter in here and the example is is example that we have already divid in here so it will take the top three examples from it and then the perfect s and here is the input variables which is equation and schema we'll use it equation in this and the schema in here so run this one this is the example of the problem let's create our second change and check this for the first question the answer is correct to box creative big advertising into people school and for the second question we get a correct answer which is elastic pad and in here we got toolbox creative but the four question the Gen cqu is also correct and we get here fali new and then for the last one okay we got a card corre answer though which is one so using the problem strategies will enhance our model right now we have all correct answer okay guys our job is done but as I've told you before that I have a bonus for you so if you're still remember we have this question where do Michael work and the problem that we got is which workers friends what industries a workers named animal associated with and we workers live in Canada and speak German so actually there's no correlation right between which workers friend and where do Michael and the reason is this line so in here we are taking top three from this list in fact we have more than three questions so what's the point to just only take this top three and that's why we need a dynamic problem so to create a dynamic problem we need a semantic similarity example selector so basically you calculate which one is the closest between the question and the Leist that we have so the first one that you need is the haing fees eddings and then the for Factor so previously we are taking the top three question from the examples list now we will use the example selector to create a dynamic Pro if you run this so where do Michael work what companies the workers named John working it's makes sense where the workers named Alice live and and what industrious of workers named amul Associated so right now the generative prom is more Dynamic and we're not just take top three from our list okay guys so we have learned about what is NOLA gr why is it important how to set up our data in May for database how to chat with our data using lank chain and open source Lam and last but not least how to enhance our model I hope this video is useful for you guys and if you have any thoughts pleas for commment so please let me know in the comment section below bye-bye\", metadata={'source': 'KMXQ4SVLwmo'})]\n"
     ]
    }
   ],
   "source": [
    "from langchain_community.document_loaders import YoutubeLoader\n",
    "loader = YoutubeLoader.from_youtube_url(\"https://youtu.be/KMXQ4SVLwmo\", add_video_info=False)\n",
    "pages = loader.load()\n",
    "print(pages)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Load & Summarize Data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\Users\\Geraldus Wilsen\\Documents\\Portfolio\\KnowledgeGraphLLM\\venv\\lib\\site-packages\\wikipedia\\wikipedia.py:389: GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system (\"html.parser\"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.\n",
      "\n",
      "The code that caused this warning is on line 389 of the file c:\\Users\\Geraldus Wilsen\\Documents\\Portfolio\\KnowledgeGraphLLM\\venv\\lib\\site-packages\\wikipedia\\wikipedia.py. To get rid of this warning, pass the additional argument 'features=\"html.parser\"' to the BeautifulSoup constructor.\n",
      "\n",
      "  lis = BeautifulSoup(html).find_all('li')\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[Document(page_content='Timothy Donald Cook (born November 1, 1960) is an American business executive who is the current chief executive officer of Apple Inc. Cook had previously been the company\\'s chief operating officer under its co-founder Steve Jobs. Cook joined Apple in March 1998 as a senior vice president for worldwide operations, and then as executive vice president for worldwide sales and operations. He was appointed chief executive on August 24, 2011 after Jobs, who was ill and died that October, resigned. During his tenure as the chief executive, he has advocated for the political reform of international and domestic surveillance, cybersecurity, American manufacturing, and environmental preservation. \\nSince 2011 when he took over Apple, to 2020, Cook doubled the company\\'s revenue and profit, and the company\\'s market value increased from $348 billion to $1.9 trillion. Cook is also on the boards of directors of Nike, Inc. and the National Football Foundation; he is a trustee of Duke University, his alma mater. Outside of Apple, Cook engages in philanthropy; in March 2015 he said he planned to donate his fortune to charity. In 2014, Cook became the first chief executive of a Fortune 500 company to publicly come out as gay.\\n\\n\\n== Early life and education ==\\nTimothy Donald Cook was born on November 1, 1960, in Mobile, Alabama. He was baptized in a Baptist church and grew up in nearby Robertsdale. His father, Donald Cook, was a shipyard worker, and his mother, Geraldine Cook, worked at a pharmacy. Cook graduated salutatorian from Robertsdale High School in Alabama in 1978. He earned a Bachelor of Science degree with a major in industrial engineering from Auburn University in 1982 and a Master of Business Administration degree from Duke University in 1988.\\n\\n\\n== Career ==\\n\\n\\n=== Pre-Apple era ===\\nAfter graduating from Auburn University, Cook spent twelve years in IBM\\'s personal computer business, ultimately as director of North American fulfillment. During this time, Cook also earned his MBA from Duke University, becoming a Fuqua Scholar in 1988. Later, he was the chief operating officer of the computer reseller division of Intelligent Electronics. In 1997, he became the vice president for corporate materials at Compaq, but took up his position at Apple six months later.\\n\\n\\n=== Apple era ===\\n\\n\\n==== Early career ====\\nIn 1998, Steve Jobs asked Cook to join Apple. In a commencement speech at Auburn University, Cook said he decided to join Apple after meeting Jobs:\\n\\nAny purely rational consideration of cost and benefits lined up in Compaq\\'s favor, and the people who knew me best advised me to stay at Compaq... On that day in early 1998, I listened to my intuition, not the left side of my brain or for that matter even the people who knew me best... no more than five minutes into my initial interview with Steve, I wanted to throw caution and logic to the wind and join Apple. My intuition already knew that joining Apple was a once-in-a-lifetime opportunity to work for the creative genius and to be on the executive team that could resurrect a great American company.\\nHis first position was senior vice president for worldwide operations. Cook closed factories and warehouses, and replaced them with contract manufacturers; this resulted in a reduction of the company\\'s inventory from months to days. Predicting its importance, his group had invested in long-term deals such as advance investment in flash memory since 2005. This guaranteed a stable supply of what became the iPod Nano, then iPhone and iPad. Competitors at Hewlett-Packard described their cancelled HP TouchPad tablet computer and later said that it was made from \"cast-off, reject iPad parts\". Cook\\'s actions were recognized for keeping costs under control, and combined with the rest of the company, generated huge profits.\\n\\nIn January 2007, Cook was promoted to lead operations and was chief executive in 2009, while Jobs, in failing health, was away on a leave of absence. In January 2011, Apple\\'s board of', metadata={'title': 'Tim Cook', 'summary': \"Timothy Donald Cook (born November 1, 1960) is an American business executive who is the current chief executive officer of Apple Inc. Cook had previously been the company's chief operating officer under its co-founder Steve Jobs. Cook joined Apple in March 1998 as a senior vice president for worldwide operations, and then as executive vice president for worldwide sales and operations. He was appointed chief executive on August 24, 2011 after Jobs, who was ill and died that October, resigned. During his tenure as the chief executive, he has advocated for the political reform of international and domestic surveillance, cybersecurity, American manufacturing, and environmental preservation. \\nSince 2011 when he took over Apple, to 2020, Cook doubled the company's revenue and profit, and the company's market value increased from $348 billion to $1.9 trillion. Cook is also on the boards of directors of Nike, Inc. and the National Football Foundation; he is a trustee of Duke University, his alma mater. Outside of Apple, Cook engages in philanthropy; in March 2015 he said he planned to donate his fortune to charity. In 2014, Cook became the first chief executive of a Fortune 500 company to publicly come out as gay.\\n\\n\", 'source': 'https://en.wikipedia.org/wiki/Tim_Cook'}),\n",
       " Document(page_content='Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It designs, develops, and sells consumer electronics, computer software, and online services. Devices include the iPhone, iPad, Mac, Apple Watch, Vision Pro, and Apple TV; operating systems include iOS, iPadOS, and macOS; and software applications and services include iTunes, iCloud, Apple Music, and Apple TV+.\\nFor most of 2011 to 2024, Apple became the world\\'s largest company by market capitalization until Microsoft assumed the position in January 2024. In 2022, Apple was the largest technology company by revenue, with US$394.3 billion. As of 2023, Apple was the fourth-largest personal computer vendor by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American information technology companies, alongside Alphabet (the parent company of Google), Amazon, Meta (the parent company of Facebook), and Microsoft.\\nApple was founded as Apple Computer Company on April 1, 1976, to produce and market Steve Wozniak\\'s Apple I personal computer. The company was incorporated by Wozniak and Steve Jobs in 1977. Its second computer, the Apple II, became a best seller as one of the first mass-produced microcomputers. Apple introduced the Lisa in 1983 and the Macintosh in 1984, as some of the first computers to use a graphical user interface and a mouse. By 1985, the company\\'s internal problems included the high cost of its products and power struggles between executives. That year Jobs left Apple to form NeXT, Inc., and Wozniak withdrew to other ventures. The market for personal computers expanded and evolved throughout the 1990s, and Apple lost considerable market share to the lower-priced Wintel duopoly of the Microsoft Windows operating system on Intel-powered PC clones.\\nIn 1997, Apple was weeks away from bankruptcy. To resolve its failed operating system strategy and entice Jobs\\'s return, it bought NeXT. Over the next decade, Jobs guided Apple back to profitability through several tactics including introducing the iMac, iPod, iPhone, and iPad to critical acclaim, launching the \"Think different\" campaign and other memorable advertising campaigns, opening the Apple Store retail chain, and acquiring numerous companies to broaden its product portfolio. Jobs resigned in 2011 for health reasons, and died two months later. He was succeeded as CEO by Tim Cook.\\nApple has received criticism regarding its contractors\\' labor practices, its environmental practices, and its business ethics, including anti-competitive practices and materials sourcing. Nevertheless, it has a large following and a high level of brand loyalty. It has been consistently ranked as one of the world\\'s most valuable brands.\\nApple became the first publicly traded U.S. company to be valued at over $1 trillion in August 2018, then at $2 trillion in August 2020, and at $3 trillion in January 2022. In June 2023, it was valued at just over $3 trillion.\\n\\n\\n== History ==\\n\\n\\n=== 1976–1980: Founding and incorporation ===\\n\\nApple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership. The company\\'s first product is the Apple I, a computer designed and hand-built entirely by Wozniak. To finance its creation, Jobs sold his Volkswagen Bus, and Wozniak sold his HP-65 calculator.:\\u200a57\\u200a Neither received the full selling price but in total earned $1,300 (equivalent to $7,000 in 2023). Wozniak debuted the first prototype Apple I at the Homebrew Computer Club in July 1976. The Apple I was sold as a motherboard with CPU, RAM, and basic textual-video chips—a base kit concept which was not yet marketed as a complete personal computer. It was priced soon after debut for $666.66 (equivalent to $3,600 in 2023).:\\u200a180\\u200a Wozniak later said he was unaware of the coincidental mark of the beast in the number 666, ', metadata={'title': 'Apple Inc.', 'summary': 'Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It designs, develops, and sells consumer electronics, computer software, and online services. Devices include the iPhone, iPad, Mac, Apple Watch, Vision Pro, and Apple TV; operating systems include iOS, iPadOS, and macOS; and software applications and services include iTunes, iCloud, Apple Music, and Apple TV+.\\nFor most of 2011 to 2024, Apple became the world\\'s largest company by market capitalization until Microsoft assumed the position in January 2024. In 2022, Apple was the largest technology company by revenue, with US$394.3 billion. As of 2023, Apple was the fourth-largest personal computer vendor by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American information technology companies, alongside Alphabet (the parent company of Google), Amazon, Meta (the parent company of Facebook), and Microsoft.\\nApple was founded as Apple Computer Company on April 1, 1976, to produce and market Steve Wozniak\\'s Apple I personal computer. The company was incorporated by Wozniak and Steve Jobs in 1977. Its second computer, the Apple II, became a best seller as one of the first mass-produced microcomputers. Apple introduced the Lisa in 1983 and the Macintosh in 1984, as some of the first computers to use a graphical user interface and a mouse. By 1985, the company\\'s internal problems included the high cost of its products and power struggles between executives. That year Jobs left Apple to form NeXT, Inc., and Wozniak withdrew to other ventures. The market for personal computers expanded and evolved throughout the 1990s, and Apple lost considerable market share to the lower-priced Wintel duopoly of the Microsoft Windows operating system on Intel-powered PC clones.\\nIn 1997, Apple was weeks away from bankruptcy. To resolve its failed operating system strategy and entice Jobs\\'s return, it bought NeXT. Over the next decade, Jobs guided Apple back to profitability through several tactics including introducing the iMac, iPod, iPhone, and iPad to critical acclaim, launching the \"Think different\" campaign and other memorable advertising campaigns, opening the Apple Store retail chain, and acquiring numerous companies to broaden its product portfolio. Jobs resigned in 2011 for health reasons, and died two months later. He was succeeded as CEO by Tim Cook.\\nApple has received criticism regarding its contractors\\' labor practices, its environmental practices, and its business ethics, including anti-competitive practices and materials sourcing. Nevertheless, it has a large following and a high level of brand loyalty. It has been consistently ranked as one of the world\\'s most valuable brands.\\nApple became the first publicly traded U.S. company to be valued at over $1 trillion in August 2018, then at $2 trillion in August 2020, and at $3 trillion in January 2022. In June 2023, it was valued at just over $3 trillion.', 'source': 'https://en.wikipedia.org/wiki/Apple_Inc.'}),\n",
       " Document(page_content='Tim Cook  (born 1971) is a Canadian military historian and author. Cook is an historian at the Canadian War Museum and the author of thirteen books about the military history of Canada.  Having written extensively about World War I, Cook\\'s focus shifted to Canada\\'s involvement in World War II with the 2014 publication of the first volume in a two-volume series chronicling Canada\\'s role in that war. He is a two-time recipient (2000 and 2015) of the C.P. Stacey Prize, a two-time recipient of the J.W. Dafoe Book Prize, and a three-time winner of the Ottawa Book Prize. He was elected to the Royal Society of Canada in 2019. He is a member of the Order of Canada.\\n\\n\\n== Background ==\\nCook was born in Kingston, Ontario, and raised in Ottawa.  He studied history at Trent University in Peterborough, and later obtained a master\\'s degree at the Royal Military College of Canada and a doctorate at the University of New South Wales.\\n\\n\\n== Awards ==\\nHis 2000 book, No Place to Run, was awarded the C.P. Stacey Prize for best written work in Canadian military history. In 2006, he published Clio\\'s Warriors, which explores the writing of the world wars in Canada. At the Sharp End: Canadians Fighting the Great War, 1914-1916, won the 2007 J.W. Dafoe award for literary non-fiction and the 2008 Ottawa Book award.  His 2008 book Shock Troops: Canadians Fighting the Great War 1917–1918 won the 2009 Charles Taylor Prize. The Madman and the Butcher: The Sensational Wars of Sam Hughes and General Arthur Currie was a finalist for the 2011 Shaughnessy Cohen Prize for Political Writing, the 2011 J.W. Dafoe prize, and the 2011 Ottawa Book Award.  His 2012 book Warlords: Borden, Mackenzie King, and Canada\\'s World Wars was a finalist for the 2013 Charles A. Taylor award for Literary Non-Fiction and the Canadian Authors Association Literary Award.\\nThe Necessary War received the 2015 C.P. Stacey Prize for best book in Canadian Military History and Fight to the Finish received the 2016 Ottawa Book Award.  In 2017, Cook published Vimy: Battle and Legend and in 2018 he published The Secret History of Soldiers: How Canadians Survived the Great War. Both were national best-sellers. Vimy received the 2017 J.W. Dafoe Book Prize and The Secret History received the Ottawa Book Prize. Almost all of these books have been national best sellers.\\nIn June 2020, Cook and J.L. Granatstein edited Canada 1919: A Nation Shaped by War Hardcover (UBC Press) and in September 2020, he published The Fight for History: 75 Years of Forgetting, Remembering, and Remaking Canada\\'s Second World War Hardcover (Allen Lane). In 2022, he published Lifesavers and Body Snatchers: Medical Care and the Struggle for Survival in the Great War. It was long-listed for the Templer prize; his Vimy book was a finalist for the same prize.\\nCook was the recipient of the 2013 Pierre Berton Award (Governor General\\'s History Award for Popular Media), which is awarded by Canada\\'s National History Society.  The award was given to Cook for his work making military history \"more accessible, vivid and factual\", both in his role as an author and as the First World War Historian at the Canadian War Museum.\\nTim Cook is a member of the Royal Society of Canada and the Order of Canada.\\n\\n\\n== Published works ==\\n\\n\\n=== Books ===\\nTim Cook (1 November 1999). No Place to Run: The Canadian Corps and Gas Warfare in the First World War. UBC Press. ISBN 978-0-7748-4180-1.\\n(Winner of the 2000 C.P. Stacey award for most distinguished book in Canadian military history)\\nTim Cook (1 November 2006). Clio\\'s Warriors: Canadian Historians and the Writing of the World Wars. UBC Press. ISBN 978-0-7748-4125-2.\\nTim Cook (16 August 2007). At the Sharp End Volume One: Canadians Fighting the Great War 1914-1916. Penguin Canada. ISBN 978-0-7352-3311-9.\\n(Winner of the 2007 J.W. Dafoe award for literary non-fiction and of the 2008 Ottawa Book award)\\n(Winner of the 2008 Ottawa Book Award)\\nTim Cook (16 August 2008). Shock Troops. Penguin Canada. ISBN 978-0-7', metadata={'title': 'Tim Cook (historian)', 'summary': \"Tim Cook  (born 1971) is a Canadian military historian and author. Cook is an historian at the Canadian War Museum and the author of thirteen books about the military history of Canada.  Having written extensively about World War I, Cook's focus shifted to Canada's involvement in World War II with the 2014 publication of the first volume in a two-volume series chronicling Canada's role in that war. He is a two-time recipient (2000 and 2015) of the C.P. Stacey Prize, a two-time recipient of the J.W. Dafoe Book Prize, and a three-time winner of the Ottawa Book Prize. He was elected to the Royal Society of Canada in 2019. He is a member of the Order of Canada.\", 'source': 'https://en.wikipedia.org/wiki/Tim_Cook_(historian)'}),\n",
       " Document(page_content='Bernard J. McGuirk (October 26, 1957 – October 5, 2022) was an American radio personality. He was host at WABC in New York City alongside Sid Rosenberg. He was born and raised in the South Bronx, New York, where he worked in his younger years as a taxi driver.\\n\\n\\n== Background ==\\nMcGuirk was an alum of Cardinal Hayes High School. He worked in radio and television since 1986 after he graduated from College of Mount Saint Vincent in the Riverdale section of the Bronx, New York. He was best known for his long run as the executive producer of Imus in the Morning, a show that was nationally syndicated from 1993 until its end in 2018.\\n\\n\\n== Controversies ==\\n\\n\\n=== Tim Cook \"religious bigot\" controversy ===\\nOn April 1, 2015, during the Imus in the Morning show on Fox Business, McGuirk called Apple CEO Tim Cook a \"bigot hypocrite\" for \"running his mouth\" about the subject of the religious freedom Indiana law passed the month prior.\\n\\nMcGuirk: There is a lot of hypocrisy. First of all, Governor Cuomo tells all his state employees don\\'t go to Indiana but he\\'s going to Cuba where gay marriage is illegal and they maybe throw you in jail. You have this hypocrite, this bigot hypocrite, Tim Cook, who is running his mouth about the whole thing.McShane: The Apple CEO?McGuirk: Yeah. He sells products to Iran. He sells products to Saudi Arabia where they execute people if they\\'re gay.McDowell: A hypocrite maybe, but a bigot?McGuirk: A religious bigot, yeah. He won\\'t allow these religious people to exercise their freedom.McShane: That seems too strong to me.McGuirk: It does seem strong but in my opinion it happens to be accurate. If he doesn\\'t allow this Orthodox Jewish guy to refuse service...the point of the law is to allow him to exempt himself from a certain situation.McShane: This will end up back in the Supreme Court somewhere.McGuirk: And the governor of Connecticut. Meanwhile the state has the same law.McShane: But I think there is a difference in the law in terms...there are small differences in these laws. Some of these state laws are just to protect you against the government not against another person. So there are differences in those state laws.McGuirk: Gay rights and religious freedom are not mutually exclusive. They both can exist in the same universe and compromises have to be made. That\\'s just the way we work things out in this country. Tim Cook has to put his money where his mouth is. If he really feels that way, stop marketing Apple products in Saudi Arabia, Iran, and Nigeria where they not only dump on women and treat them as second class citizens but as I said they would execute gay people.\\n\\n\\n=== Jill Carroll ===\\nOn the Imus in the Morning show, McGuirk was not known to shy away from saying whatever was on his mind, and always in a heavily accented \"Brooklyn cabdriver\" deadpan that seemed both to amuse and horrify Imus in equal measure. Imus\\' sidekick, Charles McCord, often played the role of the instigator, doing his best to egg on McGuirk.\\nFor example, after the release of The Christian Science Monitor reporter Jill Carroll, who was kidnapped in Iraq, McGuirk stated: \"She strikes me as the kind of woman who would wear one of those suicide vests. You know, walk into the tent or try and sneak into the Green Zone.\\n\\n\\n=== Cardinals O\\'Connor and Egan ===\\nThe son of Irish immigrants and an altar boy in his youth, McGuirk did impersonations of John Cardinal O\\'Connor and Edward Cardinal Egan (both Archbishops of New York) in which he \"fashions an oversize FedEx envelope into a cone on his head ... Using a high-pitched Irish brogue ... the producer-as-cardinal said on the March 16 installment of the show that \\'the only thing Hillary Clinton has in common with the late great President John Fitzgerald Kennedy, God rest his soul, is that they both enjoyed extramarital affairs with women.\\'\"\\n\\n\\n=== U.S. President Barack Obama ===\\nRegarding Presidential aspirant Barack Obama, McGuirk stated: \"He\\'s a neophyte, no experience. It\\'s all because he', metadata={'title': 'Bernard McGuirk', 'summary': 'Bernard J. McGuirk (October 26, 1957 – October 5, 2022) was an American radio personality. He was host at WABC in New York City alongside Sid Rosenberg. He was born and raised in the South Bronx, New York, where he worked in his younger years as a taxi driver.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Bernard_McGuirk'}),\n",
       " Document(page_content='The Mac, short for Macintosh (its official name until 1999), is a family of personal computers designed and marketed by Apple Inc. The name Macintosh is a reference to a type of apple called McIntosh. The product lineup includes the MacBook Air and MacBook Pro laptops, and the iMac, Mac Mini, Mac Studio, and Mac Pro desktops. Macs are sold with the macOS operating system.\\nJef Raskin conceived the Macintosh project in 1979, which was usurped and redefined by Apple co-founder Steve Jobs in 1981. The Macintosh has a 9-inch monochrome monitor built into the case, and was launched in January 1984, after Apple\\'s \"1984\" advertisement during Super Bowl XVIII.\\nIn 1987, the Macintosh II brought color graphics. From 1994, Power Macintosh transitioned from Motorola 68000 series processors to PowerPC. Through most of the 1990s, the Mac was not fully competitive with commodity IBM PC compatibles.\\nThe 1996 acquisition of NeXT returned Steve Jobs to Apple, whose focused product oversight pushed the Mac mainstream with the 1998 iMac G3, the OS X operating system (renamed to macOS in 2016), and the Mac transition to Intel processors from 2005 to 2006. High pixel density Retina displays debuted in the iPhone 4 in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was reinvigorated with new high-end Macs and the transition to Apple silicon, which had originated in iOS devices.\\n\\n\\n== History ==\\n\\n\\n=== 1979–1996: \"Macintosh\" era ===\\n\\nIn the late 1970s, the Apple II became one of the most popular computers, especially in education. After IBM introduced the IBM PC in 1981, its sales quickly surpassed the Apple II. In response, Apple introduced the Lisa in 1983. The Lisa\\'s graphical user interface was partially inspired by strategically licensed demonstrations of the Xerox Star. Lisa far surpassed the Star with intuitive direct manipulation, like the ability to drag and drop files, double-click to launch applications, and move or resize windows by clicking and dragging instead of going through a menu. However, hampered by its high price of $9,995 (equivalent to $33,000 in 2023) and lack of available software, the Lisa was commercially unsuccessful.\\nParallel to the Lisa\\'s development, a skunkworks team at Apple was working on the Macintosh project. Conceived in 1979 by Jef Raskin, Macintosh was envisioned as an affordable, easy-to-use computer for the masses. Raskin named the computer after his favorite type of apple, the McIntosh. The initial team consisted of Raskin, hardware engineer Burrell Smith, and Apple co-founder Steve Wozniak. In 1981, Steve Jobs was removed from the Lisa team and joined Macintosh, and was able to gradually take control of the project due to Wozniak\\'s temporary absence after an airplane crash. Under Jobs, the Mac grew to resemble the Lisa, with a mouse and a more intuitive graphical interface, at a quarter of the Lisa\\'s price.\\nUpon its January 1984 launch, the first Macintosh was described as revolutionary by The New York Times. Sales initially met projections, but dropped due to the machine\\'s low performance, single floppy disk drive requiring frequent disk swapping, and initial lack of applications. Author Douglas Adams said: \"But what I (and I think everybody else who bought the machine in the early days) fell in love with was not the machine itself, which was ridiculously slow and underpowered, but a romantic idea of the machine. And that romantic idea had to sustain me through the realities of actually working on the 128K Mac.\" Most of the original Macintosh team left Apple, and some followed Jobs to found NeXT after he was forced out by CEO John Sculley. The first Macintosh nevertheless generated cult enthusiasm among buyers and some developers, who rushed to develop entirely new programs for the platform, including PageMaker, MORE, and Excel. Apple soon released the Macintosh 512K with improved performance and an external floppy drive. The Maci', metadata={'title': 'Mac (computer)', 'summary': 'The Mac, short for Macintosh (its official name until 1999), is a family of personal computers designed and marketed by Apple Inc. The name Macintosh is a reference to a type of apple called McIntosh. The product lineup includes the MacBook Air and MacBook Pro laptops, and the iMac, Mac Mini, Mac Studio, and Mac Pro desktops. Macs are sold with the macOS operating system.\\nJef Raskin conceived the Macintosh project in 1979, which was usurped and redefined by Apple co-founder Steve Jobs in 1981. The Macintosh has a 9-inch monochrome monitor built into the case, and was launched in January 1984, after Apple\\'s \"1984\" advertisement during Super Bowl XVIII.\\nIn 1987, the Macintosh II brought color graphics. From 1994, Power Macintosh transitioned from Motorola 68000 series processors to PowerPC. Through most of the 1990s, the Mac was not fully competitive with commodity IBM PC compatibles.\\nThe 1996 acquisition of NeXT returned Steve Jobs to Apple, whose focused product oversight pushed the Mac mainstream with the 1998 iMac G3, the OS X operating system (renamed to macOS in 2016), and the Mac transition to Intel processors from 2005 to 2006. High pixel density Retina displays debuted in the iPhone 4 in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was reinvigorated with new high-end Macs and the transition to Apple silicon, which had originated in iOS devices.', 'source': 'https://en.wikipedia.org/wiki/Mac_(computer)'}),\n",
       " Document(page_content='Power Play: Tesla, Elon Musk, and the Bet of the Century is Tim Higgins\\'s book about Tesla, Inc., published in 2021, that focuses on the company while under the management of Elon Musk. The book does not contain any interviews with Musk himself, but many anonymous current and former executives from Tesla. In response to the book in general, Musk tweeted \"Higgins managed to make his book both false *and* boring\".\\n\\n\\n== Reception ==\\nStar Tribune wrote that it \"has done an outstanding job [and] performed a deep dive into the nuts and volts of Tesla.\" The Los Angeles Times Tesla reporter Russ Mitchell reviewed the book and stated \"I’ve covered Tesla as a reporter since 2016. When Higgins writes about facts and situations I’m familiar with, I can attest he’s right on the button, every time. If there’s any nonsense in “Power Play,” Higgins isn\\'t the source of it.\"\\nThe Publishers Weekly review remarked that \"Higgins takes an in-depth and well-balanced look at the interplay between Musk’s swashbuckling mindset of “building the airplane as [he] was heading down the runway” and the hardheadedness of Tesla\\'s veteran engineers and leaders, who understood the rigors of making cars that could kill people if they malfunctioned.\" NPR noted that \"[t]he book pays scant attention to Full Self-Driving Autopilot, the controversial self-driving software Musk has long promised is on the verge of perfection\" but states that it \"is hardly boring\".\\n\\n\\n== Tim Cook conversation controversy ==\\nFollowing early coverage of the book, Elon Musk denied a featured anecdote where supposedly he and Tim Cook spoke about the possibility of Apple acquiring Tesla.\\n\\n\\n== References ==', metadata={'title': 'Power Play: Tesla, Elon Musk, and the Bet of the Century', 'summary': 'Power Play: Tesla, Elon Musk, and the Bet of the Century is Tim Higgins\\'s book about Tesla, Inc., published in 2021, that focuses on the company while under the management of Elon Musk. The book does not contain any interviews with Musk himself, but many anonymous current and former executives from Tesla. In response to the book in general, Musk tweeted \"Higgins managed to make his book both false *and* boring\".\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Power_Play:_Tesla,_Elon_Musk,_and_the_Bet_of_the_Century'}),\n",
       " Document(page_content=\"Jeff Williams (born 1963) is Apple's chief operating officer under CEO Tim Cook, a position he has held since December 2015.\\n\\n\\n== Biography ==\\nWilliams joined Apple in 1998 as head of worldwide procurement and in 2004 he was named vice president of Operations. In 2007, he played a significant role in Apple's entry into the mobile phone market with the launch of the iPhone, and he has led worldwide operations for iPod and iPhone since that time.\\nPrior to Apple, Williams worked for IBM from 1985 to 1998 in a number of operations and engineering roles. He holds a B.S. in Mechanical Engineering from North Carolina State University and an MBA from Duke University. Williams attended Jesse O. Sanderson High School in Raleigh, North Carolina.\\nHe was promoted to chief operating officer on 17 December 2015.\\nOn June 27, 2019, with the announcement that Jony Ive was leaving Apple to form an independent design company with Apple as client, it was noted that design team leaders Evans Hankey, vice president of Industrial Design, and Alan Dye, vice president of Human Interface Design, will report to Jeff Williams.\\n\\n\\n== See also ==\\nSteve Jobs\\nEddy Cue\\nDan Riccio\\nJony Ive\\nPhil Schiller\\nCraig Federighi\\nSabih Khan\\n\\n\\n== References ==\", metadata={'title': 'Jeff Williams (Apple)', 'summary': \"Jeff Williams (born 1963) is Apple's chief operating officer under CEO Tim Cook, a position he has held since December 2015.\", 'source': 'https://en.wikipedia.org/wiki/Jeff_Williams_(Apple)'}),\n",
       " Document(page_content='Apple TV is a digital media player and microconsole developed and marketed by Apple Inc. It is a small piece of networking hardware that sends received media data such as video and audio to a TV or external display. Its media services include streaming media, TV Everywhere-based services, local media sources, and sports journalism and broadcasts.\\nSecond-generation and later models function only when connected via HDMI to an enhanced-definition or high-definition widescreen television. Since the fourth-generation model, Apple TV runs tvOS with multiple pre-installed apps.  In November 2019, Apple released Apple TV+ and Apple TV app a la carte.\\nApple TV lacks integrated controls and can only be controlled remotely, through a Siri Remote, iPhone or iPad, Apple Remote, or third-party infrared remotes complying with the fourth generation  Consumer Electronics Control standard.\\n\\n\\n== Background ==\\n\\nBefore the Apple TV, Apple made a number of attempts to create TV-based devices: In 1993, Apple released the Macintosh TV in an attempt to enter the home-entertainment industry. The device had a 14-inch CRT screen and a TV tuner card. It was not a commercial success, with only 10,000 sold before its discontinuation in 1994. That year, the company developed the Apple Interactive Television Box, a collaboration with BT Group and Proximus Group that was never released to the public. Apple\\'s final major attempt before the Apple TV was the Apple Pippin in 1990s, a combination home game console and networked computer.\\n\\n\\n== Models ==\\n\\n\\n=== First generation ===\\n\\nAt a September 2006 Apple special event, Apple announced the first-generation Apple TV. It was originally announced as \"iTV\" to fit into their \"i\"-based product naming convention, but was renamed \"Apple TV\" before launch due to a trademark dispute with British broadcasting network ITV, which threatened legal action against Apple. Pre-orders began in January 2007 and it was released in March 2007. It is based on a Pentium M processor and ran a variant of Mac OS X Tiger, and included a 40 GB hard disk for storing content. It supported output up to 720p on HDTVs via HDMI, and supported some standard definition televisions via component video. At launch, Apple TV required a Mac or Windows-based PC running iTunes on the same network to sync or stream content to it.\\nA model with a 160 GB hard drive was released in May 2007. The 40 GB version was discontinued in September 2009. In January 2008, it became a stand-alone device through a software update, which removed the requirement of iTunes syncing from separate computer, and allowed for media from services such as iTunes Store, MobileMe, and Flickr to be rented or purchased directly on the Apple TV.\\nIn July 2008, Apple released the software 2.1 update which added external recognition of iPhones and iPod Touches as alternative remote control devices to the Apple Remote. In September 2015, Apple discontinued iTunes support for the first-generation Apple TV, with accessibility being obstructed from such devices due to obsolete security standards.\\nThe first generation Apple TV can be modified into a makeshift intel Mac Mini, with a USB boot disk image being available online, and an install to the inbuilt hard drive possible by flashing the image to the hard drive through the USB booted disk. The device is not easily used unless a USB hub is installed, due to it only having one USB port.\\nThe first generation Apple TV has a 1 GHz Intel Pentium M CPU, and 256 MB of RAM. Neither the CPU or RAM can be upgraded without soldering, as both are soldered onto the motherboard. The device has one HDMI interface, one USB port, one 10/100 base T Ethernet port, and a Component video interface. Due to its thermal management design utilizing the upper case as a passive heat sink, the device gets warm when in use. A fan is used to cool the case, but it does not reach the CPU and is instead installed to cool the hard drive and installed power supply.\\n\\n\\n=== Second gene', metadata={'title': 'Apple TV', 'summary': 'Apple TV is a digital media player and microconsole developed and marketed by Apple Inc. It is a small piece of networking hardware that sends received media data such as video and audio to a TV or external display. Its media services include streaming media, TV Everywhere-based services, local media sources, and sports journalism and broadcasts.\\nSecond-generation and later models function only when connected via HDMI to an enhanced-definition or high-definition widescreen television. Since the fourth-generation model, Apple TV runs tvOS with multiple pre-installed apps.  In November 2019, Apple released Apple TV+ and Apple TV app a la carte.\\nApple TV lacks integrated controls and can only be controlled remotely, through a Siri Remote, iPhone or iPad, Apple Remote, or third-party infrared remotes complying with the fourth generation  Consumer Electronics Control standard.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Apple_TV'}),\n",
       " Document(page_content='Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology giant Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder of Pixar. He was a pioneer of the personal computer revolution of the 1970s and 1980s, along with his early business partner and fellow Apple co-founder Steve Wozniak.\\nJobs was born in San Francisco in 1955 and adopted shortly afterwards. He attended Reed College in 1972 before withdrawing that same year. In 1974, he traveled through India, seeking enlightenment before later studying Zen Buddhism. He and Wozniak co-founded Apple in 1976 to further develop and sell Wozniak\\'s Apple I personal computer. Together, the duo gained fame and wealth a year later with production and sale of the Apple II, one of the first highly successful mass-produced microcomputers. Jobs saw the commercial potential of the Xerox Alto in 1979, which was mouse-driven and had a graphical user interface (GUI). This led to the development of the unsuccessful Apple Lisa in 1983, followed by the breakthrough Macintosh in 1984, the first mass-produced computer with a GUI. The Macintosh launched the desktop publishing industry in 1985 with the addition of the Apple LaserWriter, the first laser printer to feature vector graphics and PostScript.\\nIn 1985, Jobs departed Apple after a long power struggle with the company\\'s board and its then-CEO, John Sculley. That same year, Jobs took some Apple employees with him to found NeXT, a computer platform development company that specialized in computers for higher-education and business markets, serving as its CEO. In 1986, he helped develop the visual effects industry by funding the computer graphics division of Lucasfilm that eventually spun off independently as Pixar, which produced the first 3D computer-animated feature film Toy Story (1995) and became a leading animation studio, producing over 27 films since.\\nIn 1997, Jobs returned to Apple as CEO after the company\\'s acquisition of NeXT. He was largely responsible for reviving Apple, which was on the verge of bankruptcy. He worked closely with British designer Jony Ive to develop a line of products and services that had larger cultural ramifications, beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes Store, iPhone, App Store, and iPad. In 2003, Jobs was diagnosed with a pancreatic neuroendocrine tumor. He died of respiratory arrest related to the tumor in 2011, and in 2022, was posthumously awarded the Presidential Medal of Freedom.\\n\\n\\n== Early life ==\\n\\n\\n=== Family ===\\nSteven Paul Jobs was born in San Francisco, California, on February 24, 1955, to Joanne Carole Schieble and Abdulfattah \"John\" Jandali (Arabic: عبد الفتاح الجندلي). Abdulfattah Jandali was born in a Muslim household to wealthy Syrian parents, the youngest of nine siblings. After obtaining his undergraduate degree at the American University of Beirut, Jandali pursued a PhD in political science at the University of Wisconsin. There, he met Joanne Schieble, an American Catholic of Swiss-German descent whose parents owned a mink farm and real estate in Green Bay. The two fell in love but faced opposition from Schieble\\'s father due to Jandali\\'s Muslim faith. When Schieble became pregnant, she arranged for a closed adoption, and travelled to San Francisco to give birth.\\nSchieble requested that her son be adopted by college graduates. A lawyer and his wife were selected, but they withdrew after discovering that the baby was a boy, so Jobs was instead adopted by Paul Reinhold and Clara (née Hagopian) Jobs. Paul Jobs, an American of German descent, was the son of a dairy farmer from Washington County, Wisconsin. After dropping out of high school, he worked as a mechanic, then joined the US Coast Guard. When his ship was decommissioned at San Francisco, he bet he could find a wife within 2 weeks. He th', metadata={'title': 'Steve Jobs', 'summary': 'Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology giant Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder of Pixar. He was a pioneer of the personal computer revolution of the 1970s and 1980s, along with his early business partner and fellow Apple co-founder Steve Wozniak.\\nJobs was born in San Francisco in 1955 and adopted shortly afterwards. He attended Reed College in 1972 before withdrawing that same year. In 1974, he traveled through India, seeking enlightenment before later studying Zen Buddhism. He and Wozniak co-founded Apple in 1976 to further develop and sell Wozniak\\'s Apple I personal computer. Together, the duo gained fame and wealth a year later with production and sale of the Apple II, one of the first highly successful mass-produced microcomputers. Jobs saw the commercial potential of the Xerox Alto in 1979, which was mouse-driven and had a graphical user interface (GUI). This led to the development of the unsuccessful Apple Lisa in 1983, followed by the breakthrough Macintosh in 1984, the first mass-produced computer with a GUI. The Macintosh launched the desktop publishing industry in 1985 with the addition of the Apple LaserWriter, the first laser printer to feature vector graphics and PostScript.\\nIn 1985, Jobs departed Apple after a long power struggle with the company\\'s board and its then-CEO, John Sculley. That same year, Jobs took some Apple employees with him to found NeXT, a computer platform development company that specialized in computers for higher-education and business markets, serving as its CEO. In 1986, he helped develop the visual effects industry by funding the computer graphics division of Lucasfilm that eventually spun off independently as Pixar, which produced the first 3D computer-animated feature film Toy Story (1995) and became a leading animation studio, producing over 27 films since.\\nIn 1997, Jobs returned to Apple as CEO after the company\\'s acquisition of NeXT. He was largely responsible for reviving Apple, which was on the verge of bankruptcy. He worked closely with British designer Jony Ive to develop a line of products and services that had larger cultural ramifications, beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes Store, iPhone, App Store, and iPad. In 2003, Jobs was diagnosed with a pancreatic neuroendocrine tumor. He died of respiratory arrest related to the tumor in 2011, and in 2022, was posthumously awarded the Presidential Medal of Freedom.', 'source': 'https://en.wikipedia.org/wiki/Steve_Jobs'}),\n",
       " Document(page_content='From 2014 until 2024, Apple Inc. undertook a research and development effort to develop an electric and self-driving car, codenamed \"Project Titan\". Apple never openly discussed any of its automotive research, but around 5,000 employees were reported to be working on the project as of 2018. In May 2018, Apple reportedly partnered with Volkswagen to produce an autonomous employee shuttle van based on the T6 Transporter commercial vehicle platform. In August 2018, the BBC reported that Apple had 66 road-registered driverless cars, with 111 drivers registered to operate those cars. In 2020, it was believed that Apple was still working on self-driving related hardware, software and service as a potential product, instead of actual Apple-branded cars. In December 2020, Reuters reported that Apple was planning on a possible launch date of 2024, but analyst Ming-Chi Kuo claimed it would not be launched before 2025 and might not be launched until 2028 or later. \\nIn February 2024, Apple executives canceled their plans to release the autonomous electric vehicle, instead shifting resources on the project to the company\\'s generative artificial intelligence efforts. The project had reportedly cost the company over $1 billion per year, with other parts of Apple collaborating and costing hundreds of millions of dollars in additional spend. Additionally, over 600 employees were laid off due to the cancellation of the project.\\n\\n\\n== Car details ==\\nThe car project cycled through multiple designs over the years. Teams at Apple outside of the development project were involved in its development. People from the Apple silicon team were heavily involved in the car to design the processor used for its autonomy. At the time of cancelation, the chip was nearly finished, and had the equivalent processing power of four M2 Ultras combined. The microkernel for the car was named \"safetyOS\".\\n\\n\\n== Proposed collaborations and acquisitions ==\\nDuring the 2008–2010 automotive industry crisis, with car companies nearing collapse, Apple SVP Tony Fadell floated to Jobs the idea of buying General Motors on the cheap. The idea was abandoned partly because the company felt that it would be a bad look, and partly because of its focus on the iPhone.\\nFollowing Apple\\'s returned interest in 2014, Apple\\'s head of corporate development Adrian Perica met with Elon Musk several times with an interest in acquiring Tesla, which kicked off the research project. Tim Cook, Apple\\'s CEO, shut down these early negotiations, partly due to Apple\\'s CFO (and former GM Europe CFO) Luca Maestri saying how difficult the car business was. Despite the failure, years later, then-hardware chief Dan Riccio and former Ford engineer and iPhone engineer Steve Zadesky returned to Musk to discuss ideas for a collaboration. A few more years later, as Tesla struggled to make its Model 3 sedan, Musk attempted to restart talks with Apple, but said Cook wouldn\\'t meet.\\nA partnership with Mercedes-Benz was worked on, and was similar to talks with and progressed further than that with Tesla. The plan was for Mercedes-Benz to manufacture the car, and Apple to also provide Mercedes-Benz its self-driving platform and UI for other cars. Apple pulled out partly because it had confidence that it could successfully manufacture a car themselves and partly over disagreements over controlling the user\\'s experience and data. The talks lasted for more than a year.\\nThe closest talks to acquire a car company were with McLaren. Some executives hoped that Jony Ive would be closer to Apple with that acquisition, following his reduced involvement in the company. BMW and Canoo, among others, were also in exploratory talks for an acquisition. Apple also met with Nissan and BYD Auto. Apple was concerned that integrating an automaker would be a disaster internally. Apple briefly partnered with Magna Steyr, a maker of low-volume vehicles for the project.\\nIn 2018, Apple signed a deal with Volkswagen to make an autonomous shuttle for ', metadata={'title': 'Apple car project', 'summary': 'From 2014 until 2024, Apple Inc. undertook a research and development effort to develop an electric and self-driving car, codenamed \"Project Titan\". Apple never openly discussed any of its automotive research, but around 5,000 employees were reported to be working on the project as of 2018. In May 2018, Apple reportedly partnered with Volkswagen to produce an autonomous employee shuttle van based on the T6 Transporter commercial vehicle platform. In August 2018, the BBC reported that Apple had 66 road-registered driverless cars, with 111 drivers registered to operate those cars. In 2020, it was believed that Apple was still working on self-driving related hardware, software and service as a potential product, instead of actual Apple-branded cars. In December 2020, Reuters reported that Apple was planning on a possible launch date of 2024, but analyst Ming-Chi Kuo claimed it would not be launched before 2025 and might not be launched until 2028 or later. \\nIn February 2024, Apple executives canceled their plans to release the autonomous electric vehicle, instead shifting resources on the project to the company\\'s generative artificial intelligence efforts. The project had reportedly cost the company over $1 billion per year, with other parts of Apple collaborating and costing hundreds of millions of dollars in additional spend. Additionally, over 600 employees were laid off due to the cancellation of the project.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Apple_car_project'}),\n",
       " Document(page_content='Apple Maps is a web mapping service developed by Apple Inc. The default map system of iOS, iPadOS, macOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public transportation navigation. A \"Flyover\" mode shows certain urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.\\nFirst released in 2012, Apple Maps replaced Google Maps as the default map system on Apple devices. At launch, it drew criticism from users and reviewers for incorrect directions, sparse data about public transportation, and various other bugs and errors. Apple has since further developed the software to address the issues raised by such criticism.\\nWhile formerly exclusive to Apple devices, Apple released a cross-platform MapKit JS API in 2018, allowing Apple Maps to be embedded on the web.\\n\\n\\n== History ==\\n\\n\\n=== Initial release ===\\n\\nApple revealed that the application would replace Google Maps as the default web mapping service for iOS. Apple also announced that the application would include turn-by-turn navigation, 3D maps, and the virtual assistant Siri. The mapping service was released on September 19, 2012. Following the launch, Apple Maps was heavily criticized, which resulted in a public apology by Apple CEO Tim Cook in late September and the departure of two key employees of Apple (see also §Early inaccuracy).\\nGoogle Maps was the default mapping app in iOS from the first generation iPhone in 2007. In late 2009, tensions between Google and Apple started when the Android version of Google Maps featured turn-by-turn navigation, a feature which the iOS version lacked. At the time, Apple argued that Google collected too much user data. When Apple made iOS 6 available, Google Maps could only be accessed by iOS 6 users via the web. Although Google did not immediately launch an iOS version Maps, shortly after the announcement of Apple Maps, Google did add a Flyover feature to its virtual globe application Google Earth. Three months later, in December 2012, Google Maps was released in the App Store. This version of Google Maps, unlike the previous version, featured turn-by-turn navigation. Shortly after it was launched, it was the most popular free application in the App Store.\\nSpeculation around Apple creating a mapping service of its own arose in 2009 after computer magazine Computerworld reported that Apple had acquired Jaron Waldman\\'s company Placebase, an online mapping service, in July of that year. The CEO of Placebase became a part of Apple\\'s \"Geo Team\". In the following two years, Apple acquired two more mapping related companies who specialized in 3D maps: Poly9 in 2010 and C3 Technologies in 2011. C3 Technologies\\' imagery was later used for the Flyovers feature in Apple Maps. Earlier in 2011, Apple indicated its plan for a mapping service when it stated on its website that it was collecting location data to create \"an improved traffic service in the next couple of years\" for iPhone users. In September 2012, when Apple Maps was released, a \"source\" connected to both Google and Apple Maps claimed to technology website TechCrunch that Apple was recruiting Google employees that worked on Google Maps.\\n\\n\\n=== 2012–2015 ===\\nIn the first year after its release, Apple Maps received a number of improvements which solved various errors in the application. Other changes included adding more satellite imagery and making the navigation available in more cities. In 2013, Apple also acquired a few companies to improve Apple Maps, namely HopStop, Embark, WifiSlam, and Locationary, as well as the team and the technology of the company BroadMap. HopStop and Embark both specialized in mapping public transportation, WifiSlam specialized in interior maps, Locationary provided accurate company data for mapping services, and BroadMap managed, sorted, and analyzed map data.\\nDuring WWDC in June 2013, Apple announced the new version of Apple Maps in iOS 7. This new versi', metadata={'title': 'Apple Maps', 'summary': 'Apple Maps is a web mapping service developed by Apple Inc. The default map system of iOS, iPadOS, macOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public transportation navigation. A \"Flyover\" mode shows certain urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.\\nFirst released in 2012, Apple Maps replaced Google Maps as the default map system on Apple devices. At launch, it drew criticism from users and reviewers for incorrect directions, sparse data about public transportation, and various other bugs and errors. Apple has since further developed the software to address the issues raised by such criticism.\\nWhile formerly exclusive to Apple devices, Apple released a cross-platform MapKit JS API in 2018, allowing Apple Maps to be embedded on the web.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Apple_Maps'}),\n",
       " Document(page_content='Scott James Forstall (born 28 August 1969) is an American software engineer, known for leading the original software development team for the iPhone and iPad. He is also a Broadway producer known for co-producing the Tony award-winning Fun Home and Eclipsed with Molly Forstall, his wife, among others. Having spent his career first at NeXT and then Apple, he was the senior vice president (SVP) of iOS Software at Apple Inc. from 2007 until October 2012.\\n\\n\\n== Early life and education ==\\nForstall grew up in a middle-class family in Kitsap County, Washington, the second-born of three boys to a registered-nurse mother Jeanne and an engineer father Tom Forstall. His older brother Bruce is also a senior software design engineer, at Microsoft.\\nA gifted student for whom skills such as programming \"came easily where they were difficult for others\", Forstall qualified for advanced-placement science and math class in junior high school, and gained experience programming on Apple IIe computers.\\nHe was skipped forward a year, entering Olympic High School in Bremerton, Washington, early where classmates recall his immersion in competitive chess, history, and general knowledge, on occasion competing at the state level. He achieved a 4.0 GPA and earned the position of valedictorian, a position he shared with a classmate, Molly Brown, who would later become his wife. He had established the goal of being a \"designer of high-tech electronics equipment\", as he proclaimed in an interview with a local newspaper.\\nEnrolling at Stanford University, he graduated in 1991 with a degree in symbolic systems. The next year he received his master\\'s degree in computer science, also from Stanford. During his time at Stanford, Forstall was a member of the Phi Kappa Psi fraternity.\\n\\n\\n== Career ==\\n\\n\\n=== NeXT / Apple ===\\nForstall joined Steve Jobs\\'s NeXT in 1992 and stayed when it was purchased by Apple in 1997. Forstall was then placed in charge of designing user interfaces for a reinvigorated Macintosh line. In 2000, Forstall became a leading designer of the Mac\\'s new Aqua user interface, known for its water-themed visual cues such as translucent icons and reflections, making him a rising star in the company. He was promoted to SVP in January 2003. During this period, he supervised the creation of the Safari web browser. Lisa Melton, a senior developer on the Safari team, credited Forstall for being willing to trust the instincts of his team and respecting their ability to develop the browser in secret.\\nIn 2005, when Jobs began planning the iPhone, he had a choice to either \"shrink the Mac, which would be an epic feat of engineering, or enlarge the iPod\". Jobs favored the former approach but pitted the Macintosh and the iPod team, led by Forstall and Tony Fadell respectively, against each other in an internal competition. Forstall won that fierce competition to create iOS. The decision enabled the success of the iPhone as a platform for third-party developers: using a well-known desktop operating system as its basis allowed the many third-party Mac developers to write software for the iPhone with minimal retraining. Forstall was also responsible for creating a software developer\\'s kit for programmers to build iPhone apps, as well as an App Store within iTunes.\\nIn 2006, Forstall became responsible for Mac OS X releases after Avie Tevanian stepped down as the company\\'s Chief Software Technology Officer and before being named SVP of iPhone Software. Forstall received credit as he \"ran the iOS mobile software team like clockwork and was widely respected for his ability to perform under pressure\".\\nHe has spoken publicly at Apple Worldwide Developers Conferences, including talks about Mac OS X Leopard in 2006 and iPhone software development in 2008, later after the release of iPhone OS 2.0 and iPhone 3G, and on January 27, 2010, at Apple\\'s 2010 iPad keynote. At WWDC 2011, Forstall introduced iOS 5. Forstall also appears in the iOS 5 video, narrating about three-quarters', metadata={'title': 'Scott Forstall', 'summary': 'Scott James Forstall (born 28 August 1969) is an American software engineer, known for leading the original software development team for the iPhone and iPad. He is also a Broadway producer known for co-producing the Tony award-winning Fun Home and Eclipsed with Molly Forstall, his wife, among others. Having spent his career first at NeXT and then Apple, he was the senior vice president (SVP) of iOS Software at Apple Inc. from 2007 until October 2012.', 'source': 'https://en.wikipedia.org/wiki/Scott_Forstall'}),\n",
       " Document(page_content='The App Store is an app marketplace developed and maintained by Apple Inc., for mobile apps on its iOS and iPadOS operating systems. The store allows users to browse and download approved apps developed within Apple\\'s iOS SDK. Apps can be downloaded on the iPhone, iPod Touch, or iPad, and some can be transferred to the Apple Watch smartwatch or 4th-generation or newer Apple TVs as extensions of iPhone apps.\\nThe App Store opened on July 10, 2008, with an initial 500 applications available. The number of apps peaked at around 2.2 million in 2017, but declined slightly over the next few years as Apple began a process to remove old or 32-bit apps. As of 2021, the store features more than 1.8 million apps.\\nWhile Apple touts the role of the App Store in creating new jobs in the \"app economy\" and claims to have paid over $155 billion to developers, the App Store has also attracted criticism from developers and government regulators that it operates a monopoly and that Apple\\'s 30% cut of revenues from the store is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple\\'s App Store are anti-competitive and would demand that Apple change its in-app payment system policies.\\n\\n\\n== History ==\\n\\nWhile originally developing iPhone prior to its unveiling in 2007, Apple\\'s then-CEO Steve Jobs did not intend to let third-party developers build native apps for iOS, instead directing them to make web applications for the Safari web browser. However, backlash from developers prompted the company to reconsider, with Jobs announcing in October 2007 that Apple would have a software development kit available for developers by February 2008. The SDK was released on March 6, 2008.\\nThe iPhone App Store opened on July 10, 2008. On July 11, the iPhone 3G was released and came pre-loaded with support for App Store. Initially apps could be free or paid, but then in 2009, Apple added the ability to add in-app purchases which quickly became the dominant way to monetize apps, especially games.\\nAfter the success of Apple\\'s App Store and the launch of similar services by its competitors, the term \"app store\" has been adopted to refer to any similar service for mobile devices. However, Apple applied for a U.S. trademark on the term \"App Store\" in 2008, which was tentatively approved in early 2011. In June 2011, U.S. District Judge Phyllis Hamilton, who was presiding over Apple\\'s case against Amazon, said she would \"probably\" deny Apple\\'s motion to stop Amazon from using the \"App Store\" name. In July, Apple was denied preliminary injunction against Amazon\\'s Appstore by a federal judge.\\nThe term app has become a popular buzzword; in January 2011, app was awarded the honor of being 2010\\'s \"Word of the Year\" by the American Dialect Society. \"App\" has been used as shorthand for \"application\" since at least the late 1970s, and in product names since at least 2006, for example then-named Google Apps.\\nApple announced Mac App Store, a similar app distribution platform for its macOS personal computer operating system, in October 2010, with the official launch taking place in January 2011 with the release of its 10.6.6 \"Snow Leopard\" update.\\nIn February 2013, Apple informed developers that they could begin using appstore.com for links to their apps. In June at its developer conference, Apple announced an upcoming \"Kids\" section in App Store, a new section featuring apps categorized by age range, and the section was launched alongside the release of iOS 7 in September 2013.\\nIn 2016, multiple media outlets reported that apps had decreased significantly in popularity. Recode wrote that \"The app boom is over\", an editorial in TechCrunch stated that \"The air of hopelessness that surrounds the mobile app ecosystem is obvious and demoralizing\", and The Verge wrote that \"the original App Store model of selling apps for a buck or two looks antiquated\". Issues included consumer \"boredom\", a lack of app discoverabi', metadata={'title': 'App Store (Apple)', 'summary': 'The App Store is an app marketplace developed and maintained by Apple Inc., for mobile apps on its iOS and iPadOS operating systems. The store allows users to browse and download approved apps developed within Apple\\'s iOS SDK. Apps can be downloaded on the iPhone, iPod Touch, or iPad, and some can be transferred to the Apple Watch smartwatch or 4th-generation or newer Apple TVs as extensions of iPhone apps.\\nThe App Store opened on July 10, 2008, with an initial 500 applications available. The number of apps peaked at around 2.2 million in 2017, but declined slightly over the next few years as Apple began a process to remove old or 32-bit apps. As of 2021, the store features more than 1.8 million apps.\\nWhile Apple touts the role of the App Store in creating new jobs in the \"app economy\" and claims to have paid over $155 billion to developers, the App Store has also attracted criticism from developers and government regulators that it operates a monopoly and that Apple\\'s 30% cut of revenues from the store is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple\\'s App Store are anti-competitive and would demand that Apple change its in-app payment system policies.', 'source': 'https://en.wikipedia.org/wiki/App_Store_(Apple)'}),\n",
       " Document(page_content='The iPhone is a line of smartphones produced by Apple Inc. that use Apple\\'s own iOS mobile operating system. The first-generation iPhone was announced by then–Apple CEO Steve Jobs on January 9, 2007. Since then, Apple has annually released new iPhone models and iOS updates. As of November 1, 2018, more than 2.2 billion iPhones had been sold.\\nThe iPhone was the first mobile phone to use multi-touch technology. Since the iPhone\\'s launch, it has gained larger screen sizes, video-recording, waterproofing, and many accessibility features. Up to the iPhone 8 and 8 Plus, iPhones had a single button on the front panel, with the iPhone 5s and later integrating a Touch ID fingerprint sensor. Since the iPhone X, iPhone models have switched to a nearly bezel-less front screen design with Face ID facial recognition, and app switching activated by gestures. Touch ID is still used for the budget iPhone SE series.\\nThe iPhone is one of the two largest smartphone platforms in the world alongside Android, and is a large part of the luxury market. The iPhone has generated large profits for Apple, making it one of the world\\'s most valuable publicly traded companies. The first-generation iPhone was described as a \"revolution\" for the mobile phone industry and subsequent models have also garnered praise. The iPhone has been credited with popularizing the smartphone and slate form factor, and with creating a large market for smartphone apps, or \"app economy\". As of January 2017, Apple\\'s App Store contained more than 2.2 million applications for the iPhone.\\n\\n\\n== History ==\\n\\nDevelopment of an Apple smartphone began in 2004, when Apple started to gather a team of 1,000 employees led by hardware engineer Tony Fadell, software engineer Scott Forstall, and design officer Jony Ive, to work on the highly confidential \"Project Purple\".\\nThen-Apple CEO Steve Jobs steered the original focus away from a tablet (which was later revisited in the form of the iPad) towards a phone. Apple created the device during a secretive collaboration with Cingular Wireless (later renamed AT&T Mobility) at an estimated development cost of US$150 million over thirty months. According to Jobs in 1998, the \"i\" word in \"iMac\" (and thereafter \"iPod\", \"iPhone\" and \"iPad\") stands for internet, individual, instruct, inform, and inspire.\\nApple rejected the \"design by committee\" approach that had yielded the Motorola ROKR E1, a largely unsuccessful \"iTunes phone\" made in collaboration with Motorola. Among other deficiencies, the ROKR E1\\'s firmware limited storage to only 100 iTunes songs to avoid competing with Apple\\'s iPod nano. Cingular gave Apple the liberty to develop the iPhone\\'s hardware and software in-house, a rare practice at the time, and paid Apple a fraction of its monthly service revenue (until the iPhone 3G), in exchange for four years of exclusive U.S. sales, until 2011.\\nJobs unveiled the first-generation iPhone to the public on January 9, 2007, at the Macworld 2007 convention at the Moscone Center in San Francisco. The iPhone incorporated a 3.5-inch multi-touch display with few hardware buttons, and ran the iPhone OS operating system with a touch-friendly interface, then marketed as a version of Mac OS X. It launched on June 29, 2007, at a starting price of US$499 in the United States, and required a two-year contract with AT&T.\\n\\nOn July 11, 2008, at Apple\\'s Worldwide Developers Conference (WWDC) 2008, Apple announced the iPhone 3G, and expanded its launch-day availability to twenty-two countries, and it was eventually released in 70 countries and territories. The iPhone 3G introduced faster 3G connectivity, and a lower starting price of US$199 (with a two-year AT&T contract). It proved commercially popular, overtaking Motorola RAZR V3 as the best selling cell phone in the US by the end of 2008. Its successor, the iPhone 3GS, was announced on June 8, 2009, at WWDC 2009, and introduced video recording functionality.\\n\\nThe iPhone 4 was announced on June 7, 2010, at WWDC 2010, ', metadata={'title': 'IPhone', 'summary': 'The iPhone is a line of smartphones produced by Apple Inc. that use Apple\\'s own iOS mobile operating system. The first-generation iPhone was announced by then–Apple CEO Steve Jobs on January 9, 2007. Since then, Apple has annually released new iPhone models and iOS updates. As of November 1, 2018, more than 2.2 billion iPhones had been sold.\\nThe iPhone was the first mobile phone to use multi-touch technology. Since the iPhone\\'s launch, it has gained larger screen sizes, video-recording, waterproofing, and many accessibility features. Up to the iPhone 8 and 8 Plus, iPhones had a single button on the front panel, with the iPhone 5s and later integrating a Touch ID fingerprint sensor. Since the iPhone X, iPhone models have switched to a nearly bezel-less front screen design with Face ID facial recognition, and app switching activated by gestures. Touch ID is still used for the budget iPhone SE series.\\nThe iPhone is one of the two largest smartphone platforms in the world alongside Android, and is a large part of the luxury market. The iPhone has generated large profits for Apple, making it one of the world\\'s most valuable publicly traded companies. The first-generation iPhone was described as a \"revolution\" for the mobile phone industry and subsequent models have also garnered praise. The iPhone has been credited with popularizing the smartphone and slate form factor, and with creating a large market for smartphone apps, or \"app economy\". As of January 2017, Apple\\'s App Store contained more than 2.2 million applications for the iPhone.', 'source': 'https://en.wikipedia.org/wiki/IPhone'}),\n",
       " Document(page_content='The Apple–FBI encryption dispute concerns whether and to what extent courts in the United States can compel manufacturers to assist in unlocking cell phones whose data are cryptographically protected. There is much debate over public access to strong encryption.\\nIn 2015 and 2016, Apple Inc. received and objected to or challenged at least 11 orders issued by United States district courts under the All Writs Act of 1789. Most of these seek to compel Apple \"to use its existing capabilities to extract data like contacts, photos and calls from locked iPhones running on operating systems iOS 7 and older\" in order to assist in criminal investigations and prosecutions. A few requests, however, involve phones with more extensive security protections, which Apple has no current ability to break. These orders would compel Apple to write new software that would let the government bypass these devices\\' security and unlock the phones.\\nThe most well-known instance of the latter category was a February 2016 court case in the United States District Court for the Central District of California. The Federal Bureau of Investigation (FBI) wanted Apple to create and electronically sign new software that would enable the FBI to unlock a work-issued iPhone 5C it recovered from one of the shooters who, in a December 2015 terrorist attack in San Bernardino, California, killed 14 people and injured 22. The two attackers later died in a shootout with police, having first destroyed their personal phones. The work phone was recovered intact but was locked with a four-digit passcode and was set to eliminate all its data after ten failed password attempts (a common anti-theft measure on smartphones). Apple declined to create the software, and a hearing was scheduled for March 22. However, a day before the hearing was supposed to happen, the government obtained a delay, saying it had found a third party able to assist in unlocking the iPhone. On March 28, the government claimed that the FBI had unlocked the iPhone and withdrew its request. In March 2018, the Los Angeles Times reported \"the FBI eventually found that Farook\\'s phone had information only about work and revealed nothing about the plot\" but cited only government claims, not evidence.\\nIn another case in Brooklyn, a magistrate judge ruled that the All Writs Act could not be used to compel Apple to unlock an iPhone. The government appealed the ruling, but then dropped the case on April 22, 2016, saying it had been given the correct passcode.\\n\\n\\n== Background ==\\n\\nIn 1993, the National Security Agency (NSA) introduced the Clipper chip, an encryption device with an acknowledged backdoor for government access, that NSA proposed be used for phone encryption. The proposal touched off a public debate, known as the Crypto Wars, and the Clipper chip was never adopted.\\nIt was revealed as a part of the 2013 mass surveillance disclosures by Edward Snowden that the NSA and the British Government Communications Headquarters (GCHQ) had access to the user data in iPhones, BlackBerry, and Android phones and could read almost all smartphone information, including SMS, location, emails, and notes. Additionally, the leak stated that Apple had been a part of the government\\'s surveillance program since 2012, however, Apple per their spokesman at the time, \"had never heard of it\".\\nAccording to The New York Times, Apple developed new encryption methods for its iOS operating system, versions 8 and later, \"so deep that Apple could no longer comply with government warrants asking for customer information to be extracted from devices.\" Throughout 2015, prosecutors advocated for the U.S. government to be able to compel decryption of iPhone contents.\\nIn September 2015, Apple released a white paper detailing the security measures in its then-new iOS 9 operating system. iPhone models including the iPhone 5C can be protected by a four-digit PIN code. After more than ten incorrect attempts to unlock the phone with the wrong PIN, the co', metadata={'title': 'Apple–FBI encryption dispute', 'summary': 'The Apple–FBI encryption dispute concerns whether and to what extent courts in the United States can compel manufacturers to assist in unlocking cell phones whose data are cryptographically protected. There is much debate over public access to strong encryption.\\nIn 2015 and 2016, Apple Inc. received and objected to or challenged at least 11 orders issued by United States district courts under the All Writs Act of 1789. Most of these seek to compel Apple \"to use its existing capabilities to extract data like contacts, photos and calls from locked iPhones running on operating systems iOS 7 and older\" in order to assist in criminal investigations and prosecutions. A few requests, however, involve phones with more extensive security protections, which Apple has no current ability to break. These orders would compel Apple to write new software that would let the government bypass these devices\\' security and unlock the phones.\\nThe most well-known instance of the latter category was a February 2016 court case in the United States District Court for the Central District of California. The Federal Bureau of Investigation (FBI) wanted Apple to create and electronically sign new software that would enable the FBI to unlock a work-issued iPhone 5C it recovered from one of the shooters who, in a December 2015 terrorist attack in San Bernardino, California, killed 14 people and injured 22. The two attackers later died in a shootout with police, having first destroyed their personal phones. The work phone was recovered intact but was locked with a four-digit passcode and was set to eliminate all its data after ten failed password attempts (a common anti-theft measure on smartphones). Apple declined to create the software, and a hearing was scheduled for March 22. However, a day before the hearing was supposed to happen, the government obtained a delay, saying it had found a third party able to assist in unlocking the iPhone. On March 28, the government claimed that the FBI had unlocked the iPhone and withdrew its request. In March 2018, the Los Angeles Times reported \"the FBI eventually found that Farook\\'s phone had information only about work and revealed nothing about the plot\" but cited only government claims, not evidence.\\nIn another case in Brooklyn, a magistrate judge ruled that the All Writs Act could not be used to compel Apple to unlock an iPhone. The government appealed the ruling, but then dropped the case on April 22, 2016, saying it had been given the correct passcode.', 'source': 'https://en.wikipedia.org/wiki/Apple%E2%80%93FBI_encryption_dispute'}),\n",
       " Document(page_content=\"The iPhone 11 is a smartphone designed, developed, and marketed by Apple Inc. It is the thirteenth generation of iPhone, succeeding the iPhone XR, and was unveiled on September 10, 2019, alongside the higher-end iPhone 11 Pro at the Steve Jobs Theater in Apple Park, Cupertino, by Apple CEO Tim Cook. Preorders began on September 13, 2019, and the phone was officially released on September 20, 2019, one day after the official public release of iOS 13.\\nDespite minimal exterior changes from the preceding iPhone XR, substantial design changes within the phone took place, including the addition of the more powerful Apple A13 Bionic chip as well as an ultra-wide dual-camera system. In October 2020, Apple halted the inclusion of both Apple EarPods and the wall adapter, citing environmental goals.\\nAs of March 2022, the iPhone 11 has sold 159.2 million units worldwide, making it the tenth best-selling smartphone of all time.\\nThe iPhone 11 as well as the iPhone 12 mini and iPhone 13 Pro with its Max variant were discontinued and removed from Apple's website after the announcement of the iPhone 14 and iPhone 14 Pro on September 7, 2022.\\n\\n\\n== History ==\\nDetails regarding the smartphone were widely leaked before the official release; complete specifications and renderings of the phone were widely publicized. Among the most significant changes were improvements in the cameras and the continuation of the 'notch' design around the frontal camera which dipped down into the screen, a feature started by the iPhone X. The official event invite which was sent out to developers contained a graphic featuring an Apple logo made of layered colored glass, implied to be the new colors for the phone. A patent filed by Apple earlier in the year also hinted at a new camera design.\\n\\n\\n== Design ==\\n\\nThe iPhone 11 was available in six colors: Purple, Yellow, Green, Black, White and Product (Red). The top of the screen retains the 'notch' design, wherein the TrueDepth camera system and phone speaker are encapsulated in a black, rounded-out rectangle that dips into the screen, similar to its predecessor, the iPhone XR. An elevated area in the top corner on the back of the iPhone acts as a camera housing, containing the microphone, the flashlight, and both of the rear-facing digital cameras.  The Apple logo on the back of the phone is centered to be equidistant to all edges and is made of a reflective material.\\n\\n\\n== Specifications ==\\n\\n\\n=== Hardware ===\\nThe iPhone 11, along with the iPhone 11 Pro, uses Apple's A13 Bionic processor, which contains a third-generation neural engine. It has three internal storage options: 64 GB, 128 GB, and 256 GB. It also has 4 GB of RAM. The iPhone 11 has an IP68 water- and dust-resistant rating along with dirt and grime, and is water-resistant up to 2 m (6.6 ft) for 30 minutes. However, the manufacturer's warranty does not cover liquid damage to the phone. Also, like previous iPhones, both phones do not have a headphone jack, and initially came with wired EarPods with a Lightning connector, although Apple no longer includes these with any device.  The iPhone 11 is the first smartphone with built-in ultra wideband hardware, via its Apple U1 chip.\\n\\n\\n==== Display ====\\nThe iPhone 11 has a 6.1-inch (15 cm) IPS LCD with a resolution of 1792 × 828 pixels (1.4 megapixels) at a pixel density of 326 PPI with a maximum brightness of 625 nits and a 1400:1 contrast ratio and it is equivalent to the iPhone XR. It supports Dolby Vision, HDR10, True-Tone, and a wide color gamut. As with the iPhone 11 Pro, XR, XS, and X, the display has a notch at the top for the TrueDepth camera system and the speaker. The display has an oleophobic coating, making it fingerprint-resistant. Apple announced in September 2019 that both the iPhone 11 and iPhone 11 Pro would show a warning notification if a display were replaced with an unauthorized part. Apple stated that problems with the phone could arise if the wrong parts or procedures were used during the repair p\", metadata={'title': 'IPhone 11', 'summary': \"The iPhone 11 is a smartphone designed, developed, and marketed by Apple Inc. It is the thirteenth generation of iPhone, succeeding the iPhone XR, and was unveiled on September 10, 2019, alongside the higher-end iPhone 11 Pro at the Steve Jobs Theater in Apple Park, Cupertino, by Apple CEO Tim Cook. Preorders began on September 13, 2019, and the phone was officially released on September 20, 2019, one day after the official public release of iOS 13.\\nDespite minimal exterior changes from the preceding iPhone XR, substantial design changes within the phone took place, including the addition of the more powerful Apple A13 Bionic chip as well as an ultra-wide dual-camera system. In October 2020, Apple halted the inclusion of both Apple EarPods and the wall adapter, citing environmental goals.\\nAs of March 2022, the iPhone 11 has sold 159.2 million units worldwide, making it the tenth best-selling smartphone of all time.\\nThe iPhone 11 as well as the iPhone 12 mini and iPhone 13 Pro with its Max variant were discontinued and removed from Apple's website after the announcement of the iPhone 14 and iPhone 14 Pro on September 7, 2022.\\n\\n\", 'source': 'https://en.wikipedia.org/wiki/IPhone_11'}),\n",
       " Document(page_content='The Subdudes (styled lowercase as The subdudes) are an American roots rock group from New Orleans. Their music blends folk, swamp pop, New Orleans rhythm and blues, Louisiana blues, country, cajun/zydeco, funk, soul and gospel with harmonic vocals. Their sound is notable for the band\\'s substitution of a tambourine player for a drummer. The subdudes formed in 1987 through a music venue in New Orleans called Tipitina\\'s.\\n\\n\\n== History ==\\nThe Subdudes often credit their songwriting to the group as a whole, although the primary songwriters are Tommy Malone (brother of The Radiators guitarist Dave Malone) and John Magnie, both former members of Little Queenie and the Percolators.  Current members of the band are:\\n\\nTommy Malone: vocals, acoustic, electric and slide guitars\\nJohn Magnie: vocals, accordion, keyboards\\nSteve Amedée: tambourine, drums, other percussion, and vocals\\nTim Cook: percussion, bass and vocals\\nJimmy Messa: bass and guitarThey are an Americana band with a rock-based sound that also shows soul,  gospel, blues, cajun/zydeco, country, and other American roots music influences. Their former bass player was Johnny Ray Allen, who had not been with the band since their 1996 farewell tour (documented the next year on the Live at Last CD) until a brief reunion in 2014. Willie Williams also contributed to three albums: Annunciation, Primitive Streak and Live at Last as a second guitarist. Annunciation (1994) was produced in part by Glyn Johns.\\nAfter regrouping in 2002 (first as The Dudes but then re-adopting the name \\'subdudes\\' in March 2003), Bob Dylan\\'s guitarist Freddy Koella helped produce Miracle Mule. The album Behind the Levee (2006) was produced by bluesman Keb\\' Mo\\' and yielded a minor hit, \"Papa Dukie and the Mud People\" (better known by its refrain, \"Love is a Beautiful Thing\"). Released in late 2007, the album Street Symphony was recorded in Nashville, Tennessee, at Blackbird Studios in March 2007 and was produced by George Massenburg, who has worked with Little Feat. Released in late 2008, Live at the Ram\\'s Head is available on CD or as a two DVD set, with one disc being the live show from \"The Ram\\'s Head\" in Annapolis, Maryland, and the second DVD being Unplugged at Pleasant Plains, with interviews and live studio footage from the recording of Street Symphony in Nashville.\\nMost recently (2009), the band\\'s self-produced Flower Petals was recorded in Magnie\\'s basement studio then mixed in Miami, Florida, by The Albert Brothers and Steve Alaimo. The album was a departure for the band, being much more country-oriented than previous releases. The cover art was by William Matthews, a Denver, Colorado, artist well known for his Old West-style paintings. Flower Petals was originally slated to be recorded as the follow-up to Miracle Mule in 2004 but was nixed by the band\\'s record company at the time, Back Porch Records. Five years later, the band members financed the recording themselves then shopped around the completed tapes.\\nThe Subdudes\\' stature as New Orleans musicians was reflected by their inclusion individually and as a group in the HBO series Treme.\\nAfter a hiatus starting in 2011, the original line-up reunited in March 2014, with Johnny Ray Allen on bass. Allen died on August 8, 2014, at age 56. The band continued to tour with Tim Cook on bass.  However, during the COVID pandemic, the band basically disbanded, posting a notice on bandsintown.com:  \"The Subdudes retired during the Covid-19 epidemic, but the members are active as solo artists and perform together on occasion.\"\\n\\n\\n== Discography ==\\n1989: The Subdudes (East West)\\n1991: Lucky (East West)\\n1994: Annunciation (High Street)\\n1996: Primitive Streak (High Street)\\n1997: Live at Last (High Street)\\n2004: Miracle Mule (EMI/Back Porch)\\n2006: Behind the Levee (EMI/Back Porch)\\n2007: Street Symphony (EMI/Back Porch)\\n2008: Live at the Ram\\'s Head (Biographica)\\n2009: Flower Petals (429 Records)\\n2016: 4 on the Floor (I. Malone. Songs and Sleeping Elephant Music)\\n2019: Li', metadata={'title': 'The Subdudes', 'summary': \"The Subdudes (styled lowercase as The subdudes) are an American roots rock group from New Orleans. Their music blends folk, swamp pop, New Orleans rhythm and blues, Louisiana blues, country, cajun/zydeco, funk, soul and gospel with harmonic vocals. Their sound is notable for the band's substitution of a tambourine player for a drummer. The subdudes formed in 1987 through a music venue in New Orleans called Tipitina's.\", 'source': 'https://en.wikipedia.org/wiki/The_Subdudes'}),\n",
       " Document(page_content='On August 31, 2014, a collection of nearly five hundred private pictures of various celebrities, mostly women, with many containing nudity, were posted on the imageboard 4chan, and swiftly disseminated by other users on websites and social networks such as Imgur and Reddit. The leak was dubbed \"The Fappening\" or \"Celebgate\" by the public. The images were initially believed to have been obtained via a breach of Apple\\'s cloud services suite iCloud, or a security issue in the iCloud API which allowed them to make unlimited attempts at guessing victims\\' passwords. Apple claimed in a press release that access was gained via spear phishing attacks.\\nThe incident was met with varied reactions from the media and fellow celebrities. Critics argued the leak was a major invasion of privacy for the photos\\' subjects, while some of the alleged subjects denied the images\\' authenticity. The leak also prompted increased concern from analysts surrounding the privacy and security of cloud computing services such as iCloud—with a particular emphasis on their use to store sensitive, private information.\\n\\n\\n== Origin of the term ==\\n\"The Fappening\" is a jocular portmanteau coined by combining the words \"fap\", an internet slang term for masturbation, and the title of the 2008 film The Happening. Though the term is a vulgarism originating either with the imageboards where the pictures were initially posted or Reddit, mainstream media outlets soon adopted the term themselves, such as the BBC.  The term has received criticism from journalists like Radhika Sanghani of The Daily Telegraph and Toyin Owoseje of the International Business Times, who said that the term not only trivialized the leak, but also, according to Sanghani, \"[made] light of a very severe situation.\" Both articles used the term extensively to describe the event, including in their headlines.\\n\"Celebgate\" is a reference to the Watergate scandal.\\n\\n\\n== Procurement and distribution ==\\nThe images were obtained via the online storage offered by Apple\\'s iCloud platform for automatically backing up photos from iOS devices, such as iPhones. Apple later reported that the victims\\' iCloud account information was obtained using \"a very targeted attack on user names, passwords and security questions\", such as phishing and brute-force attack guessing. It was believed that the images were obtained using an exploit in the Find My iPhone service. Court documents from 2014 indicated that one user created a fake email account called \"appleprivacysecurity\" to ask celebrities for security information.  The photos were being passed around privately for at least a couple of weeks before their public release on August 31. Some anonymous imageboard users at the time claimed that unreleased photos and videos exist.\\nThe hacker responsible for the leak, who described themselves as being a \"collector\", distributed the leaked images on the image boards 4chan and Anon-IB in exchange for Bitcoin.  Ultimately, the images were widely circulated online via other channels, including Imgur and Tumblr.  Celebrity gossip blogger Perez Hilton also re-posted some of the photos on his blog, but soon took them down and issued an apology, saying he had \"acted in bad taste\".\\nA major center of activity was the link-sharing website Reddit, where a subreddit, /r/TheFappening, was created for sharing the photos; in a single day, it amassed over 100,000 followers.  Reddit administrators were criticized for allowing this to take place in an alleged violation of their anti-doxing rules. As McKayla Maroney claimed to be under 18 at the time the photos of her were taken, Reddit staff took photos of her down and warned that anyone re-posting them, or underage photos of Liz Lee which had been circulating prior to this incident, would be permanently banned from the site and could be prosecuted for distributing child pornography. On September 7, citing copyright issues, Reddit banned /r/TheFappening, also saying the workload of dealing with them ', metadata={'title': '2014 celebrity nude photo leak', 'summary': 'On August 31, 2014, a collection of nearly five hundred private pictures of various celebrities, mostly women, with many containing nudity, were posted on the imageboard 4chan, and swiftly disseminated by other users on websites and social networks such as Imgur and Reddit. The leak was dubbed \"The Fappening\" or \"Celebgate\" by the public. The images were initially believed to have been obtained via a breach of Apple\\'s cloud services suite iCloud, or a security issue in the iCloud API which allowed them to make unlimited attempts at guessing victims\\' passwords. Apple claimed in a press release that access was gained via spear phishing attacks.\\nThe incident was met with varied reactions from the media and fellow celebrities. Critics argued the leak was a major invasion of privacy for the photos\\' subjects, while some of the alleged subjects denied the images\\' authenticity. The leak also prompted increased concern from analysts surrounding the privacy and security of cloud computing services such as iCloud—with a particular emphasis on their use to store sensitive, private information.', 'source': 'https://en.wikipedia.org/wiki/2014_celebrity_nude_photo_leak'}),\n",
       " Document(page_content=\"Thomas Kurian (born 1966) is an Indian-American business executive and Chief Executive Officer of Google Cloud (under Alphabet Inc.) since 2019.\\n\\n\\n== Early life ==\\nThomas Kurian was born to P.C. Kurian and his wife Molly in 1966 in Pampady village of Kottayam district in Kerala, India. Kurian senior was a chemical engineer and the general manager of Graphite India. Thomas Kurian was one among four brothers including his identical twin George Kurian, who was in 2015 made the CEO of NetApp.\\nAs their father's career involved moving around India, the twins boarded at the Jesuit-run St Joseph's Boys High School in Bangalore. Both were accepted to the university IIT Madras. There they both took SAT tests and sent the results to various colleges, including Princeton University, which offered both of them partial scholarship places. At the age of 17, along with George Kurian, he moved to the United States. Kurian graduated from Princeton with a bachelor's degree in electrical engineering, from which he graduated summa cum laude.\\n\\n\\n== McKinsey and Stanford ==\\nAfter Princeton, Kurian started his career with McKinsey & Company as a consultant serving clients in the software, telecommunications, and financial services industries for 6 years in London and Brussels. He also pursued an MBA from Stanford Graduate School of Business.\\n\\n\\n== Oracle ==\\nKurian joined Oracle in 1996, initially holding various product management and development positions. His first executive role was as Vice President of Oracle's e-Business division. In this role, he drove a number of company-wide initiatives focused on transforming Oracle into an e-Business.\\nNext Kurian took responsibility for the Oracle Fusion Middleware product family. Under his leadership, that business became the company's fastest-growing business and the industry's leading middleware product suite.\\nLater, Kurian served as a Senior Vice President of Oracle's Server Technologies Division responsible for the development and delivery of Oracle Application Servers. He played a key role in bringing Oracle 9i application server to market. Application server software became Oracle's fastest-growing business primarily because of his efforts. Kurian served as a member of Oracle's executive committee for 13 years. He led 35,000-people software development team in 32 countries with an R&D budget of $4 billion. He also helped in the transformation of Oracle's products with the introduction of leading suite of Cloud Services, led 60 software acquisitions and Oracle's 45 Cloud data centres.\\nAs the President of Product Development, he oversaw Oracle's 3,000-odd product development efforts. He was responsible for development and delivery of Oracle's software product portfolio including Oracle Database, Oracle Fusion Middleware, and ERP, CRM, and supply chain management applications.\\nThomas Kurian was the 18th highest-paid man in the US in 2010, according to CNN. He was also the fifth highest-paid tech executive in 2010.\\nOn September 6, 2018, Kurian announced he was taking extended time off from the company. Kurian and Larry Ellison reportedly had a falling out over the direction of its cloud business.\\nOn September 28, 2018, he resigned as president of product development at Oracle.\\n\\n\\n== Google ==\\nKurian joined Google's Cloud organization in November 2018.  During his first year at Google, Kurian focused on selling G Suite applications to enterprise clients. He has reorganized the sales team to align with Sales practices of enterprise clients.\\n\\n\\n== References ==\", metadata={'title': 'Thomas Kurian', 'summary': 'Thomas Kurian (born 1966) is an Indian-American business executive and Chief Executive Officer of Google Cloud (under Alphabet Inc.) since 2019.', 'source': 'https://en.wikipedia.org/wiki/Thomas_Kurian'}),\n",
       " Document(page_content='The iPhone 15 and iPhone 15 Plus  smartphones designed, developed, and marketed by Apple Inc. They are the seventeenth and current generation of iPhones, succeeding the iPhone 14 and iPhone 14 Plus. The devices were announced on September 12, 2023, during the Apple Event at Apple Park in Cupertino, California alongside the higher-priced iPhone 15 Pro and 15 Pro Max. Pre-orders began on September 15, 2023, and the devices were made available on September 22, 2023. Like the iPhone 15 Pro and Pro Max, the 15 and 15 Plus are the first iPhones to replace the proprietary Lightning connector with USB-C to comply with European Union mandates.\\n\\n\\n== History ==\\nIn September 2021, the European Commission began considering a proposal to mandate USB-C on all devices in the European Union, including iPhones. Apple analyst Ming-Chi Kuo claimed that Apple would drop its proprietary Lightning connector by 2023. At the time of those claims, Apple was considering switching to USB-C due to the likelihood that the EU proposal would pass. The proposal was passed into law in October 2022, becoming the Radio Equipment Directive. Apple confirmed it would comply with the regulations later that month.\\nTwo weeks prior to the formal introduction of the iPhone 15, it was announced that some of the devices which were made in India would for the first time be sold around the world on the launch day.\\n\\n\\n== Design ==\\n\\nThe iPhone 15 is the first major redesign since the iPhone 12, featuring rounder edges and slightly curved display and back glass. Both models are available in five colors: blue, pink, yellow, green and black. This makes it the first entry level iPhone since the iPhone XR to not ship with a Product Red variant at launch.\\n\\n\\n== Hardware ==\\n\\n\\n=== Display ===\\nThe iPhone 15 features a 6.1-inch (155 mm) display with Super Retina XDR OLED technology at a resolution of 2556×1179 pixels and a pixel density of about 460 PPI with a refresh rate of 60 Hz. The iPhone 15 Plus features a 6.7-inch (170 mm) display with the same technology at a resolution of 2796×1290 pixels and a pixel density of about 460 PPI. Both models have an improved typical brightness of up to 1,000 nits, a peak HDR brightness of up to 1,600 nits, and a peak outdoor brightness of up to 2,000 nits. The Dynamic Island feature is now standard on iPhone 15, replacing the notch that was introduced in the iPhone X.\\n\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\\n\\n\\n=== Charging and transfer speeds ===\\nThe iPhone 15 and iPhone 15 Plus use USB-C with USB 2.0 transfer speeds (up to 480 Mb/s or 60 MB/s), compared to the iPhone 15 Pro and iPhone 15 Pro Max which have faster USB 3.2 Gen 2 transfer speeds (up to 10 Gb/s or 1.25 GB/s). The iPhone 15 and iPhone 15 Plus, as well as the iPhone 15 Pro and iPhone 15 Pro Max, are the first iPhone models to use USB-C, as well as the first iPhones since the iPhone 5 to switch to a new charging port.\\n\\n\\n=== Video output ===\\nAll iPhone 15 models have support for DisplayPort Alternate Mode over USB-C video output with HDR up to 4K resolution.\\nPrevious iPhone models (from iPhone 5 until iPhone 14) had a maximum supported resolution of 1600 x 900 (slightly less than 1080p) with the Lightning Digital AV Adapter due to technical constraints of the Lightning connector.\\n\\n\\n=== Battery ===\\nThe iPhone 15 Plus offers users up to 26 hours of video playback and up to 100 hours of audio playback, and the iPhone 15 offers significantly less, with up to 20 hours of video playback and up to 80 hours of audio playback.\\n\\n\\n== Software ==\\nThe iPhone 15 and 15 Plus launched with iOS 17.\\n\\n\\n== Features ==\\n\\n\\n=== Photography ===\\nThe iPhone 15 series introduces the ability to add Portrait mode effects to photos taken in the standard Photo mode. This feature utilizes computational photography techniques to analyze the image, identify the subject (person, pet, etc.), and apply a simulated background blur. Users can adjust the intensity of the blur effect after taking the photo, allowing for more creative control ', metadata={'title': 'IPhone 15', 'summary': 'The iPhone 15 and iPhone 15 Plus  smartphones designed, developed, and marketed by Apple Inc. They are the seventeenth and current generation of iPhones, succeeding the iPhone 14 and iPhone 14 Plus. The devices were announced on September 12, 2023, during the Apple Event at Apple Park in Cupertino, California alongside the higher-priced iPhone 15 Pro and 15 Pro Max. Pre-orders began on September 15, 2023, and the devices were made available on September 22, 2023. Like the iPhone 15 Pro and Pro Max, the 15 and 15 Plus are the first iPhones to replace the proprietary Lightning connector with USB-C to comply with European Union mandates.', 'source': 'https://en.wikipedia.org/wiki/IPhone_15'}),\n",
       " Document(page_content=\"Peter Oppenheimer is the former senior vice president and Chief Financial Officer of  Apple Inc. and has been a member of the board of directors of Goldman Sachs since 2014.\\nOppenheimer spent 18 years at Apple, reporting directly to CEO Tim Cook and serving on the company's executive committee.  As CFO, Oppenheimer oversaw the controller, treasury, investor relations, tax, information systems, internal audit, facilities, corporate development, and human resources functions. He retired from Apple in 2014.\\n\\n\\n== Education ==\\nOppenheimer attended California Polytechnic State University where he was a member of the Alpha Gamma Rho fraternity. He graduated with a BA in Agricultural Business in 1985, later receiving an MBA from Santa Clara University, both with honors.\\nIn 2015, Oppenheimer and his wife, Mary Beth, made a $20 million cash donation to Cal Poly, the university's largest to date.\\n\\n\\n== Career ==\\nOppenheimer spent six years in the Information Technology Consulting Practice with Coopers and Lybrand (now PricewaterhouseCoopers) where he managed financial, systems engagements for clients in the insurance, telecommunications, transportation and banking industries. Oppenheimer then joined Automatic Data Processing (ADP), where he was Chief Financial Officer of the Claims Services Division.\\nIn 1996, Oppenheimer joined Apple as controller for the Americas.  In 1997, he was promoted to vice president and Worldwide Sales controller and then to corporate controller.\\nOn March 3, 2014, Oppenheimer announced that he would be joining the Board of Directors of Goldman Sachs as an independent director. On March 4, 2014, he announced that he would retire from Apple at the end of September, 2014.\\n\\n\\n== References ==\", metadata={'title': 'Peter Oppenheimer', 'summary': \"Peter Oppenheimer is the former senior vice president and Chief Financial Officer of  Apple Inc. and has been a member of the board of directors of Goldman Sachs since 2014.\\nOppenheimer spent 18 years at Apple, reporting directly to CEO Tim Cook and serving on the company's executive committee.  As CFO, Oppenheimer oversaw the controller, treasury, investor relations, tax, information systems, internal audit, facilities, corporate development, and human resources functions. He retired from Apple in 2014.\", 'source': 'https://en.wikipedia.org/wiki/Peter_Oppenheimer'}),\n",
       " Document(page_content='Clayton Morris (born December 31, 1976) is an American YouTuber, real estate investor, and former television news anchor. He co-hosts Redacted News on the video platform Rumble and on his eponymous YouTube channel and a podcast on Investing in Real Estate.\\nAfter co-hosting The Daily Buzz and Good Day Philadelphia on Fox\\'s WTXF-TV, he was a co-host of Fox & Friends Weekend on Fox News Channel from 2008 to 2017. He covered consumer technology for Fox and hosted weekly technology segments for Fox News Radio and Fox News. On September 4, 2017, he left Fox News. His real estate ventures have been the subject of several lawsuits, including one filed by the state of Indiana.\\n\\n\\n== Early life ==\\nMorris was born in Philadelphia and attended Wilson High School in Spring Township in Berks County (today West Lawn, Pennsylvania), during which time he briefly hosted a comedy show on the local Berks Community Television public access channel. He graduated with a bachelor\\'s degree from the University of Pittsburgh in 1999.\\n\\n\\n== Career ==\\n\\n\\n=== Television, film, and radio ===\\nIn 2000, Morris appeared in a low-budget thriller film entitled Deception. His television career began when he was a producer for Good Day LA at KTTV, the Fox-owned television station in Los Angeles. \\nMorris then went on to reporting and anchoring positions at WVVA in Bluefield, West Virginia, and later with the Montana Television Network as a political reporter in the state capital, Helena. He went on to work for The Daily Buzz, a syndicated television morning show, as news correspondent and later host.\\nIn January 2007, Morris was hired by WTXF-TV, the Fox TV station in Philadelphia, to host its morning show, Good Day Philadelphia. He announced in October 2007 that he would leave the station at year\\'s end. Morris then co-hosted Fox & Friends Weekend for Fox News Channel from 2008 to 2017.\\nIn 2012, Morris won the seventh annual \"New York\\'s Funniest Reporter\" contest, which benefits the Humane Society of New York.\\n\\n\\n=== Financial journalism and real estate ventures ===\\nMorris hosts the Investing in Real Estate podcast and Morris Invest YouTube channel, and he developed the Financial Freedom Academy, an online financial planning service. Morris and his wife Natali Morris co-authored a book, How to Pay Off Your Mortgage in 5 Years. They also co-host a daily YouTube show on their Redacted channel.\\nIn March 2019, investors filed more than two dozen lawsuits in Indiana and New Jersey, claiming that Morris was running a Ponzi scheme involving the sales of some houses in C- and D-class neighborhoods that were marketed through his investment company, Morris Invest, in Indianapolis. The investors claimed they were sold rental properties which Morris Invest promised to rehabilitate and rent out, earning them rental income. These properties belonged to Bert Whalen. Some investors claimed that they later discovered the properties they received rental income from for several months were boarded up and vacant, and they began receiving city code and country health department violations. Others found they had purchased vacant lots, small shacks or buildings that were falling down. Morris denied responsibility, asserting he referred investors to Whalen and that Whalen was responsible for managing the properties, even though many investors believed they were dealing directly with Morris. In November 2019, Whalen was indicted by a federal grand jury for defrauding investors; the indictment did not name Morris. Whalen pleaded guilty in March 2022. \\nMorris sued HoltonWiseTV in federal court in October 2019 for $7.2 million, alleging copyright infringement; the case stemmed from HoltonWiseTV\\'s production of a three-hour documentary investigating the alleged involvement of Morris in various real estate scams. In March 2020, Morris lost the suit.\\nIn May 2020, the state of Indiana filed a civil lawsuit against Clayton Morris, among others, for violating Indiana\\'s deceptive sales and home loan acts ', metadata={'title': 'Clayton Morris', 'summary': \"Clayton Morris (born December 31, 1976) is an American YouTuber, real estate investor, and former television news anchor. He co-hosts Redacted News on the video platform Rumble and on his eponymous YouTube channel and a podcast on Investing in Real Estate.\\nAfter co-hosting The Daily Buzz and Good Day Philadelphia on Fox's WTXF-TV, he was a co-host of Fox & Friends Weekend on Fox News Channel from 2008 to 2017. He covered consumer technology for Fox and hosted weekly technology segments for Fox News Radio and Fox News. On September 4, 2017, he left Fox News. His real estate ventures have been the subject of several lawsuits, including one filed by the state of Indiana.\", 'source': 'https://en.wikipedia.org/wiki/Clayton_Morris'}),\n",
       " Document(page_content=\"Timothy Cook (born 20 February 1974) is a former Australian rules footballer who played for Adelaide in the Australian Football League (AFL).\\n\\n\\n== Early life ==\\nTim Cook started playing football at North Clare in the North Eastern Football League he was part of five junior colts flags in a row. He then played a full A Grade season at 15 years of age in 1989. Cook then went to Rostrevor College for two years. He played in the South Australian Teal Cup, impressing to be selected for an Australian tour in Ireland. He was also in the South Australian Under 17 cricket team as a left arm orthodox spinner and middle-order batsman. Cook made his SANFL debut for Central District at 17. \\n\\n\\n== Career ==\\nIn 1996 Cook played his first SANFL state game and was selected on the original Port Adelaide Football Club list. However Cook was traded alongside Aaron Keating for Scott Hodges. Cook made his debut for the Crows in round 2 of 1997 against Richmond, the game was most notable for coach Malcolm Blight claiming ruckman David Pittman as pathetic. Cook played a majority of 1997 for Centrals, only playing 4 games for the Crows. This would also be the case in 1998 and Cook was delisted. \\nCook continued to play for Centrals until 2000 when he missed out on premiership success, he played 117 games and kicking 138 goals. At 26 he then went to North Adelaide and won their best and fairest. Cook finished for North Adelaide in 2005 playing 89 games and kicking 31 goals for the Roosters.\\n\\n\\n== References ==\\n\\n\\n== External links ==\\nTim Cook's playing statistics from AFL Tables\", metadata={'title': 'Tim Cook (footballer)', 'summary': 'Timothy Cook (born 20 February 1974) is a former Australian rules footballer who played for Adelaide in the Australian Football League (AFL).', 'source': 'https://en.wikipedia.org/wiki/Tim_Cook_(footballer)'}),\n",
       " Document(page_content='The Apple Store is a chain of retail stores owned and operated by Apple Inc. The stores sell various Apple products, including Mac personal computers, iPhone smartphones, iPad tablet computers, Apple Watch smartwatches, Apple TV digital media players, software, and both Apple-branded and selected third-party accessories.\\nThe first Apple Stores were originally opened as two locations in May 2001 by then-CEO Steve Jobs, after years of attempting but failing store-within-a-store concepts. Seeing a need for improved retail presentation of the company\\'s products, he began an effort in 1997 to revamp the retail program to get an improved relationship with consumers and hired Ron Johnson in 2000. Jobs relaunched Apple\\'s online store in 1997 and opened the first two physical stores in 2001. The media initially speculated that Apple would fail, but its stores were highly successful, bypassing the sales numbers of competing nearby stores and within three years reached US$1 billion in annual sales, becoming the fastest retailer in history to do so. Apple has expanded the number of retail locations and its geographical coverage over the years, with 529 stores across 26 countries and regions worldwide, opening its latest store in Shanghai, China on March 21, 2024 with one another planned store in the USA. Strong product sales have placed Apple among the top-tier retail stores, with sales over $16 billion globally in 2011.\\nIn May 2016, Angela Ahrendts, Apple\\'s then-Senior Vice President of retail, unveiled a significantly redesigned Apple Store in Union Square, San Francisco, featuring large glass doors for the entry, open spaces, and rebranded rooms. \\nMany Apple Stores are located inside shopping malls, but Apple has built several stand-alone flagship stores in high-profile locations. It has been granted design patents and received architectural awards for its stores\\' designs and construction, specifically for its use of glass staircases and cubes. The success of Apple Stores has had significant influence over other consumer electronics retailers, who have lost traffic, control and profits due to perceived higher quality of service and products at Apple Stores. Apple\\'s notable brand loyalty among consumers causes long lines of hundreds of people at new Apple Store openings or product releases. Due to the popularity of the brand, Apple receives many job applications, many of which come from young workers. Apple Store employees receive above-average pay, are offered money toward education and health care, and receive product discounts; however, there are limited or no paths of career advancement. A May 2016 report with an anonymous retail employee highlighted a hostile work environment with harassment from customers, intense internal criticism, and a lack of significant bonuses for securing major business contracts.\\n\\n\\n== Overview ==\\n\\nMany Apple Stores are located inside shopping malls, but Apple has several stand-alone flagship stores in high-profile locations, such as the one located in Grand Central Terminal in New York City. Several multi-level stores feature glass staircases, and some also glass bridges. The New York Times wrote in 2011 that these features were part of then-CEO Steve Jobs\\' extensive attention to detail, and Apple received a design patent in 2002 for its glass staircase design. Historically, Apple has partnered with architectural firm Bohlin Cywinski Jackson in designing and creating its original retail stores, and has in recent years partnered with architectural firm Foster + Partners in designing its newer stores, as well as its corporate Apple Park campus.\\n\\nApple has received numerous architectural awards for its store designs, and its \"iconic\" glass cube, designed in part by Peter Bohlin, at Apple\\'s Fifth Avenue store in New York City, received a separate design patent in 2014.\\nRon Johnson held the position of Senior Vice President of Retail Operations from 2001 until November 1, 2011. During his tenure, it was report', metadata={'title': 'Apple Store', 'summary': \"The Apple Store is a chain of retail stores owned and operated by Apple Inc. The stores sell various Apple products, including Mac personal computers, iPhone smartphones, iPad tablet computers, Apple Watch smartwatches, Apple TV digital media players, software, and both Apple-branded and selected third-party accessories.\\nThe first Apple Stores were originally opened as two locations in May 2001 by then-CEO Steve Jobs, after years of attempting but failing store-within-a-store concepts. Seeing a need for improved retail presentation of the company's products, he began an effort in 1997 to revamp the retail program to get an improved relationship with consumers and hired Ron Johnson in 2000. Jobs relaunched Apple's online store in 1997 and opened the first two physical stores in 2001. The media initially speculated that Apple would fail, but its stores were highly successful, bypassing the sales numbers of competing nearby stores and within three years reached US$1 billion in annual sales, becoming the fastest retailer in history to do so. Apple has expanded the number of retail locations and its geographical coverage over the years, with 529 stores across 26 countries and regions worldwide, opening its latest store in Shanghai, China on March 21, 2024 with one another planned store in the USA. Strong product sales have placed Apple among the top-tier retail stores, with sales over $16 billion globally in 2011.\\nIn May 2016, Angela Ahrendts, Apple's then-Senior Vice President of retail, unveiled a significantly redesigned Apple Store in Union Square, San Francisco, featuring large glass doors for the entry, open spaces, and rebranded rooms. \\nMany Apple Stores are located inside shopping malls, but Apple has built several stand-alone flagship stores in high-profile locations. It has been granted design patents and received architectural awards for its stores' designs and construction, specifically for its use of glass staircases and cubes. The success of Apple Stores has had significant influence over other consumer electronics retailers, who have lost traffic, control and profits due to perceived higher quality of service and products at Apple Stores. Apple's notable brand loyalty among consumers causes long lines of hundreds of people at new Apple Store openings or product releases. Due to the popularity of the brand, Apple receives many job applications, many of which come from young workers. Apple Store employees receive above-average pay, are offered money toward education and health care, and receive product discounts; however, there are limited or no paths of career advancement. A May 2016 report with an anonymous retail employee highlighted a hostile work environment with harassment from customers, intense internal criticism, and a lack of significant bonuses for securing major business contracts.\\n\\n\", 'source': 'https://en.wikipedia.org/wiki/Apple_Store'})]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "query = \"Tim Cook\"\n",
    "raw_documents = WikipediaLoader(query=query).load()\n",
    "raw_documents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Timothy Donald Cook (born November 1, 1960) is an American business executive who is the current chief executive officer of Apple Inc. Cook had previously been the company's chief operating officer under its co-founder Steve Jobs. Cook joined Apple in March 1998 as a senior vice president for worldwide operations, and then as executive vice president for worldwide sales and operations. He was appointed chief executive on August 24, 2011 after Jobs, who was ill and died that October, resigned. During his tenure as the chief executive, he has advocated for the political reform of international and domestic surveillance, cybersecurity, American manufacturing, and environmental preservation. Since 2011 when he took over Apple, to 2020, Cook doubled the company's revenue and profit, and the company's market value increased from $348 billion to $1.9 trillion. Cook is also on the boards of directors of Nike, Inc. and the National Football Foundation; he is a trustee of Duke University, his alma mater. Outside of Apple, Cook engages in philanthropy; in March 2015 he said he planned to donate his fortune to charity. In 2014, Cook became the first chief executive of a Fortune 500 company to publicly come out as gay. Early life and education Timothy Donald Cook was born on November 1, 1960, in Mobile, Alabama. He was baptized in a Baptist church and grew up in nearby Robertsdale. His father, Donald Cook, was a shipyard worker, and his mother, Geraldine Cook, worked at a pharmacy. Cook graduated salutatorian from Robertsdale High School in Alabama in 1978. He earned a Bachelor of Science degree with a major in industrial engineering from Auburn University in 1982 and a Master of Business Administration degree from Duke University in 1988. Career = Pre-Apple era =After graduating from Auburn University, Cook spent twelve years in IBM's personal computer business, ultimately as director of North American fulfillment. During this time, Cook also earned his MBA from Duke University, becoming a Fuqua Scholar in 1988. Later, he was the chief operating officer of the computer reseller division of Intelligent Electronics. In 1997, he became the vice president for corporate materials at Compaq, but took up his position at Apple six months later.= Apple era = Early career In 1998, Steve Jobs asked Cook to join Apple. In a commencement speech at Auburn University, Cook said he decided to join Apple after meeting Jobs:Any purely rational consideration of cost and benefits lined up in Compaq's favor, and the people who knew me best advised me to stay at Compaq... On that day in early 1998, I listened to my intuition, not the left side of my brain or for that matter even the people who knew me best... no more than five minutes into my initial interview with Steve, I wanted to throw caution and logic to the wind and join Apple. My intuition already knew that joining Apple was a once-in-a-lifetime opportunity to work for the creative genius and to be on the executive team that could resurrect a great American company.His first position was senior vice president for worldwide operations. Cook closed factories and warehouses, and replaced them with contract manufacturers; this resulted in a reduction of the company's inventory from months to days. Predicting its importance, his group had invested in long-term deals such as advance investment in flash memory since 2005. This guaranteed a stable supply of what became the iPod Nano, then iPhone and iPad. Competitors at Hewlett-Packard described their cancelled HP TouchPad tablet computer and later said that it was made from \"cast-off, reject iPad parts\". Cook's actions were recognized for keeping costs under control, and combined with the rest of the company, generated huge profits.In January 2007, Cook was promoted to lead operations and was chief executive in 2009, while Jobs, in failing health, was away on a leave of absence. In January 2011, Apple's board of Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It designs, develops, and sells consumer electronics, computer software, and online services. Devices include the iPhone, iPad, Mac, Apple Watch, Vision Pro, and Apple TV; operating systems include iOS, iPadOS, and macOS; and software applications and services include iTunes, iCloud, Apple Music, and Apple TV+.For most of 2011 to 2024, Apple became the world's largest company by market capitalization until Microsoft assumed the position in January 2024. In 2022, Apple was the largest technology company by revenue, with US$394.3 billion. As of 2023, Apple was the fourth-largest personal computer vendor by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American information technology companies, alongside Alphabet (the parent company of Google), Amazon, Meta (the parent company of Facebook), and Microsoft.Apple was founded as Apple Computer Company on April 1, 1976, to produce and market Steve Wozniak's Apple I personal computer. The company was incorporated by Wozniak and Steve Jobs in 1977. Its second computer, the Apple II, became a best seller as one of the first mass-produced microcomputers. Apple introduced the Lisa in 1983 and the Macintosh in 1984, as some of the first computers to use a graphical user interface and a mouse. By 1985, the company's internal problems included the high cost of its products and power struggles between executives. That year Jobs left Apple to form NeXT, Inc., and Wozniak withdrew to other ventures. The market for personal computers expanded and evolved throughout the 1990s, and Apple lost considerable market share to the lower-priced Wintel duopoly of the Microsoft Windows operating system on Intel-powered PC clones.In 1997, Apple was weeks away from bankruptcy. To resolve its failed operating system strategy and entice Jobs's return, it bought NeXT. Over the next decade, Jobs guided Apple back to profitability through several tactics including introducing the iMac, iPod, iPhone, and iPad to critical acclaim, launching the \"Think different\" campaign and other memorable advertising campaigns, opening the Apple Store retail chain, and acquiring numerous companies to broaden its product portfolio. Jobs resigned in 2011 for health reasons, and died two months later. He was succeeded as CEO by Tim Cook.Apple has received criticism regarding its contractors' labor practices, its environmental practices, and its business ethics, including anti-competitive practices and materials sourcing. Nevertheless, it has a large following and a high level of brand loyalty. It has been consistently ranked as one of the world's most valuable brands.Apple became the first publicly traded U.S. company to be valued at over $1 trillion in August 2018, then at $2 trillion in August 2020, and at $3 trillion in January 2022. In June 2023, it was valued at just over $3 trillion. History = 1976–1980: Founding and incorporation =Apple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership. The company's first product is the Apple I, a computer designed and hand-built entirely by Wozniak. To finance its creation, Jobs sold his Volkswagen Bus, and Wozniak sold his HP-65 calculator.: 57  Neither received the full selling price but in total earned $1,300 (equivalent to $7,000 in 2023). Wozniak debuted the first prototype Apple I at the Homebrew Computer Club in July 1976. The Apple I was sold as a motherboard with CPU, RAM, and basic textual-video chips—a base kit concept which was not yet marketed as a complete personal computer. It was priced soon after debut for $666.66 (equivalent to $3,600 in 2023).: 180  Wozniak later said he was unaware of the coincidental mark of the beast in the number 666,  The Mac, short for Macintosh (its official name until 1999), is a family of personal computers designed and marketed by Apple Inc. The name Macintosh is a reference to a type of apple called McIntosh. The product lineup includes the MacBook Air and MacBook Pro laptops, and the iMac, Mac Mini, Mac Studio, and Mac Pro desktops. Macs are sold with the macOS operating system.Jef Raskin conceived the Macintosh project in 1979, which was usurped and redefined by Apple co-founder Steve Jobs in 1981. The Macintosh has a 9-inch monochrome monitor built into the case, and was launched in January 1984, after Apple's \"1984\" advertisement during Super Bowl XVIII.In 1987, the Macintosh II brought color graphics. From 1994, Power Macintosh transitioned from Motorola 68000 series processors to PowerPC. Through most of the 1990s, the Mac was not fully competitive with commodity IBM PC compatibles.The 1996 acquisition of NeXT returned Steve Jobs to Apple, whose focused product oversight pushed the Mac mainstream with the 1998 iMac G3, the OS X operating system (renamed to macOS in 2016), and the Mac transition to Intel processors from 2005 to 2006. High pixel density Retina displays debuted in the iPhone 4 in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was reinvigorated with new high-end Macs and the transition to Apple silicon, which had originated in iOS devices. History = 1979–1996: \"Macintosh\" era =In the late 1970s, the Apple II became one of the most popular computers, especially in education. After IBM introduced the IBM PC in 1981, its sales quickly surpassed the Apple II. In response, Apple introduced the Lisa in 1983. The Lisa's graphical user interface was partially inspired by strategically licensed demonstrations of the Xerox Star. Lisa far surpassed the Star with intuitive direct manipulation, like the ability to drag and drop files, double-click to launch applications, and move or resize windows by clicking and dragging instead of going through a menu. However, hampered by its high price of $9,995 (equivalent to $33,000 in 2023) and lack of available software, the Lisa was commercially unsuccessful.Parallel to the Lisa's development, a skunkworks team at Apple was working on the Macintosh project. Conceived in 1979 by Jef Raskin, Macintosh was envisioned as an affordable, easy-to-use computer for the masses. Raskin named the computer after his favorite type of apple, the McIntosh. The initial team consisted of Raskin, hardware engineer Burrell Smith, and Apple co-founder Steve Wozniak. In 1981, Steve Jobs was removed from the Lisa team and joined Macintosh, and was able to gradually take control of the project due to Wozniak's temporary absence after an airplane crash. Under Jobs, the Mac grew to resemble the Lisa, with a mouse and a more intuitive graphical interface, at a quarter of the Lisa's price.Upon its January 1984 launch, the first Macintosh was described as revolutionary by The New York Times. Sales initially met projections, but dropped due to the machine's low performance, single floppy disk drive requiring frequent disk swapping, and initial lack of applications. Author Douglas Adams said: \"But what I (and I think everybody else who bought the machine in the early days) fell in love with was not the machine itself, which was ridiculously slow and underpowered, but a romantic idea of the machine. And that romantic idea had to sustain me through the realities of actually working on the 128K Mac.\" Most of the original Macintosh team left Apple, and some followed Jobs to found NeXT after he was forced out by CEO John Sculley. The first Macintosh nevertheless generated cult enthusiasm among buyers and some developers, who rushed to develop entirely new programs for the platform, including PageMaker, MORE, and Excel. Apple soon released the Macintosh 512K with improved performance and an external floppy drive. The Maci From 2014 until 2024, Apple Inc. undertook a research and development effort to develop an electric and self-driving car, codenamed \"Project Titan\". Apple never openly discussed any of its automotive research, but around 5,000 employees were reported to be working on the project as of 2018. In May 2018, Apple reportedly partnered with Volkswagen to produce an autonomous employee shuttle van based on the T6 Transporter commercial vehicle platform. In August 2018, the BBC reported that Apple had 66 road-registered driverless cars, with 111 drivers registered to operate those cars. In 2020, it was believed that Apple was still working on self-driving related hardware, software and service as a potential product, instead of actual Apple-branded cars. In December 2020, Reuters reported that Apple was planning on a possible launch date of 2024, but analyst Ming-Chi Kuo claimed it would not be launched before 2025 and might not be launched until 2028 or later. In February 2024, Apple executives canceled their plans to release the autonomous electric vehicle, instead shifting resources on the project to the company's generative artificial intelligence efforts. The project had reportedly cost the company over $1 billion per year, with other parts of Apple collaborating and costing hundreds of millions of dollars in additional spend. Additionally, over 600 employees were laid off due to the cancellation of the project. Car details The car project cycled through multiple designs over the years. Teams at Apple outside of the development project were involved in its development. People from the Apple silicon team were heavily involved in the car to design the processor used for its autonomy. At the time of cancelation, the chip was nearly finished, and had the equivalent processing power of four M2 Ultras combined. The microkernel for the car was named \"safetyOS\". Proposed collaborations and acquisitions During the 2008–2010 automotive industry crisis, with car companies nearing collapse, Apple SVP Tony Fadell floated to Jobs the idea of buying General Motors on the cheap. The idea was abandoned partly because the company felt that it would be a bad look, and partly because of its focus on the iPhone.Following Apple's returned interest in 2014, Apple's head of corporate development Adrian Perica met with Elon Musk several times with an interest in acquiring Tesla, which kicked off the research project. Tim Cook, Apple's CEO, shut down these early negotiations, partly due to Apple's CFO (and former GM Europe CFO) Luca Maestri saying how difficult the car business was. Despite the failure, years later, then-hardware chief Dan Riccio and former Ford engineer and iPhone engineer Steve Zadesky returned to Musk to discuss ideas for a collaboration. A few more years later, as Tesla struggled to make its Model 3 sedan, Musk attempted to restart talks with Apple, but said Cook wouldn't meet.A partnership with Mercedes-Benz was worked on, and was similar to talks with and progressed further than that with Tesla. The plan was for Mercedes-Benz to manufacture the car, and Apple to also provide Mercedes-Benz its self-driving platform and UI for other cars. Apple pulled out partly because it had confidence that it could successfully manufacture a car themselves and partly over disagreements over controlling the user's experience and data. The talks lasted for more than a year.The closest talks to acquire a car company were with McLaren. Some executives hoped that Jony Ive would be closer to Apple with that acquisition, following his reduced involvement in the company. BMW and Canoo, among others, were also in exploratory talks for an acquisition. Apple also met with Nissan and BYD Auto. Apple was concerned that integrating an automaker would be a disaster internally. Apple briefly partnered with Magna Steyr, a maker of low-volume vehicles for the project.In 2018, Apple signed a deal with Volkswagen to make an autonomous shuttle for  Apple Maps is a web mapping service developed by Apple Inc. The default map system of iOS, iPadOS, macOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public transportation navigation. A \"Flyover\" mode shows certain urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.First released in 2012, Apple Maps replaced Google Maps as the default map system on Apple devices. At launch, it drew criticism from users and reviewers for incorrect directions, sparse data about public transportation, and various other bugs and errors. Apple has since further developed the software to address the issues raised by such criticism.While formerly exclusive to Apple devices, Apple released a cross-platform MapKit JS API in 2018, allowing Apple Maps to be embedded on the web. History = Initial release =Apple revealed that the application would replace Google Maps as the default web mapping service for iOS. Apple also announced that the application would include turn-by-turn navigation, 3D maps, and the virtual assistant Siri. The mapping service was released on September 19, 2012. Following the launch, Apple Maps was heavily criticized, which resulted in a public apology by Apple CEO Tim Cook in late September and the departure of two key employees of Apple (see also §Early inaccuracy).Google Maps was the default mapping app in iOS from the first generation iPhone in 2007. In late 2009, tensions between Google and Apple started when the Android version of Google Maps featured turn-by-turn navigation, a feature which the iOS version lacked. At the time, Apple argued that Google collected too much user data. When Apple made iOS 6 available, Google Maps could only be accessed by iOS 6 users via the web. Although Google did not immediately launch an iOS version Maps, shortly after the announcement of Apple Maps, Google did add a Flyover feature to its virtual globe application Google Earth. Three months later, in December 2012, Google Maps was released in the App Store. This version of Google Maps, unlike the previous version, featured turn-by-turn navigation. Shortly after it was launched, it was the most popular free application in the App Store.Speculation around Apple creating a mapping service of its own arose in 2009 after computer magazine Computerworld reported that Apple had acquired Jaron Waldman's company Placebase, an online mapping service, in July of that year. The CEO of Placebase became a part of Apple's \"Geo Team\". In the following two years, Apple acquired two more mapping related companies who specialized in 3D maps: Poly9 in 2010 and C3 Technologies in 2011. C3 Technologies' imagery was later used for the Flyovers feature in Apple Maps. Earlier in 2011, Apple indicated its plan for a mapping service when it stated on its website that it was collecting location data to create \"an improved traffic service in the next couple of years\" for iPhone users. In September 2012, when Apple Maps was released, a \"source\" connected to both Google and Apple Maps claimed to technology website TechCrunch that Apple was recruiting Google employees that worked on Google Maps.= 2012–2015 =In the first year after its release, Apple Maps received a number of improvements which solved various errors in the application. Other changes included adding more satellite imagery and making the navigation available in more cities. In 2013, Apple also acquired a few companies to improve Apple Maps, namely HopStop, Embark, WifiSlam, and Locationary, as well as the team and the technology of the company BroadMap. HopStop and Embark both specialized in mapping public transportation, WifiSlam specialized in interior maps, Locationary provided accurate company data for mapping services, and BroadMap managed, sorted, and analyzed map data.During WWDC in June 2013, Apple announced the new version of Apple Maps in iOS 7. This new versi The App Store is an app marketplace developed and maintained by Apple Inc., for mobile apps on its iOS and iPadOS operating systems. The store allows users to browse and download approved apps developed within Apple's iOS SDK. Apps can be downloaded on the iPhone, iPod Touch, or iPad, and some can be transferred to the Apple Watch smartwatch or 4th-generation or newer Apple TVs as extensions of iPhone apps.The App Store opened on July 10, 2008, with an initial 500 applications available. The number of apps peaked at around 2.2 million in 2017, but declined slightly over the next few years as Apple began a process to remove old or 32-bit apps. As of 2021, the store features more than 1.8 million apps.While Apple touts the role of the App Store in creating new jobs in the \"app economy\" and claims to have paid over $155 billion to developers, the App Store has also attracted criticism from developers and government regulators that it operates a monopoly and that Apple's 30% cut of revenues from the store is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple's App Store are anti-competitive and would demand that Apple change its in-app payment system policies. History While originally developing iPhone prior to its unveiling in 2007, Apple's then-CEO Steve Jobs did not intend to let third-party developers build native apps for iOS, instead directing them to make web applications for the Safari web browser. However, backlash from developers prompted the company to reconsider, with Jobs announcing in October 2007 that Apple would have a software development kit available for developers by February 2008. The SDK was released on March 6, 2008.The iPhone App Store opened on July 10, 2008. On July 11, the iPhone 3G was released and came pre-loaded with support for App Store. Initially apps could be free or paid, but then in 2009, Apple added the ability to add in-app purchases which quickly became the dominant way to monetize apps, especially games.After the success of Apple's App Store and the launch of similar services by its competitors, the term \"app store\" has been adopted to refer to any similar service for mobile devices. However, Apple applied for a U.S. trademark on the term \"App Store\" in 2008, which was tentatively approved in early 2011. In June 2011, U.S. District Judge Phyllis Hamilton, who was presiding over Apple's case against Amazon, said she would \"probably\" deny Apple's motion to stop Amazon from using the \"App Store\" name. In July, Apple was denied preliminary injunction against Amazon's Appstore by a federal judge.The term app has become a popular buzzword; in January 2011, app was awarded the honor of being 2010's \"Word of the Year\" by the American Dialect Society. \"App\" has been used as shorthand for \"application\" since at least the late 1970s, and in product names since at least 2006, for example then-named Google Apps.Apple announced Mac App Store, a similar app distribution platform for its macOS personal computer operating system, in October 2010, with the official launch taking place in January 2011 with the release of its 10.6.6 \"Snow Leopard\" update.In February 2013, Apple informed developers that they could begin using appstore.com for links to their apps. In June at its developer conference, Apple announced an upcoming \"Kids\" section in App Store, a new section featuring apps categorized by age range, and the section was launched alongside the release of iOS 7 in September 2013.In 2016, multiple media outlets reported that apps had decreased significantly in popularity. Recode wrote that \"The app boom is over\", an editorial in TechCrunch stated that \"The air of hopelessness that surrounds the mobile app ecosystem is obvious and demoralizing\", and The Verge wrote that \"the original App Store model of selling apps for a buck or two looks antiquated\". Issues included consumer \"boredom\", a lack of app discoverabi Apple TV is a digital media player and microconsole developed and marketed by Apple Inc. It is a small piece of networking hardware that sends received media data such as video and audio to a TV or external display. Its media services include streaming media, TV Everywhere-based services, local media sources, and sports journalism and broadcasts.Second-generation and later models function only when connected via HDMI to an enhanced-definition or high-definition widescreen television. Since the fourth-generation model, Apple TV runs tvOS with multiple pre-installed apps.  In November 2019, Apple released Apple TV+ and Apple TV app a la carte.Apple TV lacks integrated controls and can only be controlled remotely, through a Siri Remote, iPhone or iPad, Apple Remote, or third-party infrared remotes complying with the fourth generation  Consumer Electronics Control standard. Background Before the Apple TV, Apple made a number of attempts to create TV-based devices: In 1993, Apple released the Macintosh TV in an attempt to enter the home-entertainment industry. The device had a 14-inch CRT screen and a TV tuner card. It was not a commercial success, with only 10,000 sold before its discontinuation in 1994. That year, the company developed the Apple Interactive Television Box, a collaboration with BT Group and Proximus Group that was never released to the public. Apple's final major attempt before the Apple TV was the Apple Pippin in 1990s, a combination home game console and networked computer. Models = First generation =At a September 2006 Apple special event, Apple announced the first-generation Apple TV. It was originally announced as \"iTV\" to fit into their \"i\"-based product naming convention, but was renamed \"Apple TV\" before launch due to a trademark dispute with British broadcasting network ITV, which threatened legal action against Apple. Pre-orders began in January 2007 and it was released in March 2007. It is based on a Pentium M processor and ran a variant of Mac OS X Tiger, and included a 40 GB hard disk for storing content. It supported output up to 720p on HDTVs via HDMI, and supported some standard definition televisions via component video. At launch, Apple TV required a Mac or Windows-based PC running iTunes on the same network to sync or stream content to it.A model with a 160 GB hard drive was released in May 2007. The 40 GB version was discontinued in September 2009. In January 2008, it became a stand-alone device through a software update, which removed the requirement of iTunes syncing from separate computer, and allowed for media from services such as iTunes Store, MobileMe, and Flickr to be rented or purchased directly on the Apple TV.In July 2008, Apple released the software 2.1 update which added external recognition of iPhones and iPod Touches as alternative remote control devices to the Apple Remote. In September 2015, Apple discontinued iTunes support for the first-generation Apple TV, with accessibility being obstructed from such devices due to obsolete security standards.The first generation Apple TV can be modified into a makeshift intel Mac Mini, with a USB boot disk image being available online, and an install to the inbuilt hard drive possible by flashing the image to the hard drive through the USB booted disk. The device is not easily used unless a USB hub is installed, due to it only having one USB port.The first generation Apple TV has a 1 GHz Intel Pentium M CPU, and 256 MB of RAM. Neither the CPU or RAM can be upgraded without soldering, as both are soldered onto the motherboard. The device has one HDMI interface, one USB port, one 10/100 base T Ethernet port, and a Component video interface. Due to its thermal management design utilizing the upper case as a passive heat sink, the device gets warm when in use. A fan is used to cool the case, but it does not reach the CPU and is instead installed to cool the hard drive and installed power supply.= Second gene Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology giant Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder of Pixar. He was a pioneer of the personal computer revolution of the 1970s and 1980s, along with his early business partner and fellow Apple co-founder Steve Wozniak.Jobs was born in San Francisco in 1955 and adopted shortly afterwards. He attended Reed College in 1972 before withdrawing that same year. In 1974, he traveled through India, seeking enlightenment before later studying Zen Buddhism. He and Wozniak co-founded Apple in 1976 to further develop and sell Wozniak's Apple I personal computer. Together, the duo gained fame and wealth a year later with production and sale of the Apple II, one of the first highly successful mass-produced microcomputers. Jobs saw the commercial potential of the Xerox Alto in 1979, which was mouse-driven and had a graphical user interface (GUI). This led to the development of the unsuccessful Apple Lisa in 1983, followed by the breakthrough Macintosh in 1984, the first mass-produced computer with a GUI. The Macintosh launched the desktop publishing industry in 1985 with the addition of the Apple LaserWriter, the first laser printer to feature vector graphics and PostScript.In 1985, Jobs departed Apple after a long power struggle with the company's board and its then-CEO, John Sculley. That same year, Jobs took some Apple employees with him to found NeXT, a computer platform development company that specialized in computers for higher-education and business markets, serving as its CEO. In 1986, he helped develop the visual effects industry by funding the computer graphics division of Lucasfilm that eventually spun off independently as Pixar, which produced the first 3D computer-animated feature film Toy Story (1995) and became a leading animation studio, producing over 27 films since.In 1997, Jobs returned to Apple as CEO after the company's acquisition of NeXT. He was largely responsible for reviving Apple, which was on the verge of bankruptcy. He worked closely with British designer Jony Ive to develop a line of products and services that had larger cultural ramifications, beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes Store, iPhone, App Store, and iPad. In 2003, Jobs was diagnosed with a pancreatic neuroendocrine tumor. He died of respiratory arrest related to the tumor in 2011, and in 2022, was posthumously awarded the Presidential Medal of Freedom. Early life = Family =Steven Paul Jobs was born in San Francisco, California, on February 24, 1955, to Joanne Carole Schieble and Abdulfattah \"John\" Jandali (Arabic: عبد الفتاح الجندلي). Abdulfattah Jandali was born in a Muslim household to wealthy Syrian parents, the youngest of nine siblings. After obtaining his undergraduate degree at the American University of Beirut, Jandali pursued a PhD in political science at the University of Wisconsin. There, he met Joanne Schieble, an American Catholic of Swiss-German descent whose parents owned a mink farm and real estate in Green Bay. The two fell in love but faced opposition from Schieble's father due to Jandali's Muslim faith. When Schieble became pregnant, she arranged for a closed adoption, and travelled to San Francisco to give birth.Schieble requested that her son be adopted by college graduates. A lawyer and his wife were selected, but they withdrew after discovering that the baby was a boy, so Jobs was instead adopted by Paul Reinhold and Clara (née Hagopian) Jobs. Paul Jobs, an American of German descent, was the son of a dairy farmer from Washington County, Wisconsin. After dropping out of high school, he worked as a mechanic, then joined the US Coast Guard. When his ship was decommissioned at San Francisco, he bet he could find a wife within 2 weeks. He th The iPhone is a line of smartphones produced by Apple Inc. that use Apple's own iOS mobile operating system. The first-generation iPhone was announced by then–Apple CEO Steve Jobs on January 9, 2007. Since then, Apple has annually released new iPhone models and iOS updates. As of November 1, 2018, more than 2.2 billion iPhones had been sold.The iPhone was the first mobile phone to use multi-touch technology. Since the iPhone's launch, it has gained larger screen sizes, video-recording, waterproofing, and many accessibility features. Up to the iPhone 8 and 8 Plus, iPhones had a single button on the front panel, with the iPhone 5s and later integrating a Touch ID fingerprint sensor. Since the iPhone X, iPhone models have switched to a nearly bezel-less front screen design with Face ID facial recognition, and app switching activated by gestures. Touch ID is still used for the budget iPhone SE series.The iPhone is one of the two largest smartphone platforms in the world alongside Android, and is a large part of the luxury market. The iPhone has generated large profits for Apple, making it one of the world's most valuable publicly traded companies. The first-generation iPhone was described as a \"revolution\" for the mobile phone industry and subsequent models have also garnered praise. The iPhone has been credited with popularizing the smartphone and slate form factor, and with creating a large market for smartphone apps, or \"app economy\". As of January 2017, Apple's App Store contained more than 2.2 million applications for the iPhone. History Development of an Apple smartphone began in 2004, when Apple started to gather a team of 1,000 employees led by hardware engineer Tony Fadell, software engineer Scott Forstall, and design officer Jony Ive, to work on the highly confidential \"Project Purple\".Then-Apple CEO Steve Jobs steered the original focus away from a tablet (which was later revisited in the form of the iPad) towards a phone. Apple created the device during a secretive collaboration with Cingular Wireless (later renamed AT&T Mobility) at an estimated development cost of US$150 million over thirty months. According to Jobs in 1998, the \"i\" word in \"iMac\" (and thereafter \"iPod\", \"iPhone\" and \"iPad\") stands for internet, individual, instruct, inform, and inspire.Apple rejected the \"design by committee\" approach that had yielded the Motorola ROKR E1, a largely unsuccessful \"iTunes phone\" made in collaboration with Motorola. Among other deficiencies, the ROKR E1's firmware limited storage to only 100 iTunes songs to avoid competing with Apple's iPod nano. Cingular gave Apple the liberty to develop the iPhone's hardware and software in-house, a rare practice at the time, and paid Apple a fraction of its monthly service revenue (until the iPhone 3G), in exchange for four years of exclusive U.S. sales, until 2011.Jobs unveiled the first-generation iPhone to the public on January 9, 2007, at the Macworld 2007 convention at the Moscone Center in San Francisco. The iPhone incorporated a 3.5-inch multi-touch display with few hardware buttons, and ran the iPhone OS operating system with a touch-friendly interface, then marketed as a version of Mac OS X. It launched on June 29, 2007, at a starting price of US$499 in the United States, and required a two-year contract with AT&T.On July 11, 2008, at Apple's Worldwide Developers Conference (WWDC) 2008, Apple announced the iPhone 3G, and expanded its launch-day availability to twenty-two countries, and it was eventually released in 70 countries and territories. The iPhone 3G introduced faster 3G connectivity, and a lower starting price of US$199 (with a two-year AT&T contract). It proved commercially popular, overtaking Motorola RAZR V3 as the best selling cell phone in the US by the end of 2008. Its successor, the iPhone 3GS, was announced on June 8, 2009, at WWDC 2009, and introduced video recording functionality.The iPhone 4 was announced on June 7, 2010, at WWDC 2010, \n"
     ]
    }
   ],
   "source": [
    "filtered_raw_documents = [raw_documents[i] for i in [0,1,4,7,8,9,10,12,13]] #0: Tim Cook (person), 1: Apple (company), 4: Mac (product), 10: Research, 11: Apple Maps, 13: App Store, 7: Apple TV, 8: Steve Jobs, 13: iPhone\n",
    "docs = \" \".join([d.page_content for d in filtered_raw_documents]).replace(\"\\n\", \"\").replace(\"==\", \"\")\n",
    "print(docs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Document(page_content='Timothy Donald Cook (born November 1, 1960) is an American business executive who is the current chief executive officer of Apple Inc. Cook had previously been the company\\'s chief operating officer under its co-founder Steve Jobs. Cook joined Apple in March 1998 as a senior vice president for worldwide operations, and then as executive vice president for worldwide sales and operations. He was appointed chief executive on August 24, 2011 after Jobs, who was ill and died that October, resigned. During his tenure as the chief executive, he has advocated for the political reform of international and domestic surveillance, cybersecurity, American manufacturing, and environmental preservation. \\nSince 2011 when he took over Apple, to 2020, Cook doubled the company\\'s revenue and profit, and the company\\'s market value increased from $348 billion to $1.9 trillion. Cook is also on the boards of directors of Nike, Inc. and the National Football Foundation; he is a trustee of Duke University, his alma mater. Outside of Apple, Cook engages in philanthropy; in March 2015 he said he planned to donate his fortune to charity. In 2014, Cook became the first chief executive of a Fortune 500 company to publicly come out as gay.\\n\\n\\n== Early life and education ==\\nTimothy Donald Cook was born on November 1, 1960, in Mobile, Alabama. He was baptized in a Baptist church and grew up in nearby Robertsdale. His father, Donald Cook, was a shipyard worker, and his mother, Geraldine Cook, worked at a pharmacy. Cook graduated salutatorian from Robertsdale High School in Alabama in 1978. He earned a Bachelor of Science degree with a major in industrial engineering from Auburn University in 1982 and a Master of Business Administration degree from Duke University in 1988.\\n\\n\\n== Career ==\\n\\n\\n=== Pre-Apple era ===\\nAfter graduating from Auburn University, Cook spent twelve years in IBM\\'s personal computer business, ultimately as director of North American fulfillment. During this time, Cook also earned his MBA from Duke University, becoming a Fuqua Scholar in 1988. Later, he was the chief operating officer of the computer reseller division of Intelligent Electronics. In 1997, he became the vice president for corporate materials at Compaq, but took up his position at Apple six months later.\\n\\n\\n=== Apple era ===\\n\\n\\n==== Early career ====\\nIn 1998, Steve Jobs asked Cook to join Apple. In a commencement speech at Auburn University, Cook said he decided to join Apple after meeting Jobs:\\n\\nAny purely rational consideration of cost and benefits lined up in Compaq\\'s favor, and the people who knew me best advised me to stay at Compaq... On that day in early 1998, I listened to my intuition, not the left side of my brain or for that matter even the people who knew me best... no more than five minutes into my initial interview with Steve, I wanted to throw caution and logic to the wind and join Apple. My intuition already knew that joining Apple was a once-in-a-lifetime opportunity to work for the creative genius and to be on the executive team that could resurrect a great American company.\\nHis first position was senior vice president for worldwide operations. Cook closed factories and warehouses, and replaced them with contract manufacturers; this resulted in a reduction of the company\\'s inventory from months to days. Predicting its importance, his group had invested in long-term deals such as advance investment in flash memory since 2005. This guaranteed a stable supply of what became the iPod Nano, then iPhone and iPad. Competitors at Hewlett-Packard described their cancelled HP TouchPad tablet computer and later said that it was made from \"cast-off, reject iPad parts\". Cook\\'s actions were recognized for keeping costs under control, and combined with the rest of the company, generated huge profits.\\n\\nIn January 2007, Cook was promoted to lead operations and was chief executive in 2009, while Jobs, in failing health, was away on a leave of absence. In January 2011, Apple\\'s board of', metadata={'title': 'Tim Cook', 'summary': \"Timothy Donald Cook (born November 1, 1960) is an American business executive who is the current chief executive officer of Apple Inc. Cook had previously been the company's chief operating officer under its co-founder Steve Jobs. Cook joined Apple in March 1998 as a senior vice president for worldwide operations, and then as executive vice president for worldwide sales and operations. He was appointed chief executive on August 24, 2011 after Jobs, who was ill and died that October, resigned. During his tenure as the chief executive, he has advocated for the political reform of international and domestic surveillance, cybersecurity, American manufacturing, and environmental preservation. \\nSince 2011 when he took over Apple, to 2020, Cook doubled the company's revenue and profit, and the company's market value increased from $348 billion to $1.9 trillion. Cook is also on the boards of directors of Nike, Inc. and the National Football Foundation; he is a trustee of Duke University, his alma mater. Outside of Apple, Cook engages in philanthropy; in March 2015 he said he planned to donate his fortune to charity. In 2014, Cook became the first chief executive of a Fortune 500 company to publicly come out as gay.\\n\\n\", 'source': 'https://en.wikipedia.org/wiki/Tim_Cook'}),\n",
       " Document(page_content='Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It designs, develops, and sells consumer electronics, computer software, and online services. Devices include the iPhone, iPad, Mac, Apple Watch, Vision Pro, and Apple TV; operating systems include iOS, iPadOS, and macOS; and software applications and services include iTunes, iCloud, Apple Music, and Apple TV+.\\nFor most of 2011 to 2024, Apple became the world\\'s largest company by market capitalization until Microsoft assumed the position in January 2024. In 2022, Apple was the largest technology company by revenue, with US$394.3 billion. As of 2023, Apple was the fourth-largest personal computer vendor by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American information technology companies, alongside Alphabet (the parent company of Google), Amazon, Meta (the parent company of Facebook), and Microsoft.\\nApple was founded as Apple Computer Company on April 1, 1976, to produce and market Steve Wozniak\\'s Apple I personal computer. The company was incorporated by Wozniak and Steve Jobs in 1977. Its second computer, the Apple II, became a best seller as one of the first mass-produced microcomputers. Apple introduced the Lisa in 1983 and the Macintosh in 1984, as some of the first computers to use a graphical user interface and a mouse. By 1985, the company\\'s internal problems included the high cost of its products and power struggles between executives. That year Jobs left Apple to form NeXT, Inc., and Wozniak withdrew to other ventures. The market for personal computers expanded and evolved throughout the 1990s, and Apple lost considerable market share to the lower-priced Wintel duopoly of the Microsoft Windows operating system on Intel-powered PC clones.\\nIn 1997, Apple was weeks away from bankruptcy. To resolve its failed operating system strategy and entice Jobs\\'s return, it bought NeXT. Over the next decade, Jobs guided Apple back to profitability through several tactics including introducing the iMac, iPod, iPhone, and iPad to critical acclaim, launching the \"Think different\" campaign and other memorable advertising campaigns, opening the Apple Store retail chain, and acquiring numerous companies to broaden its product portfolio. Jobs resigned in 2011 for health reasons, and died two months later. He was succeeded as CEO by Tim Cook.\\nApple has received criticism regarding its contractors\\' labor practices, its environmental practices, and its business ethics, including anti-competitive practices and materials sourcing. Nevertheless, it has a large following and a high level of brand loyalty. It has been consistently ranked as one of the world\\'s most valuable brands.\\nApple became the first publicly traded U.S. company to be valued at over $1 trillion in August 2018, then at $2 trillion in August 2020, and at $3 trillion in January 2022. In June 2023, it was valued at just over $3 trillion.\\n\\n\\n== History ==\\n\\n\\n=== 1976–1980: Founding and incorporation ===\\n\\nApple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership. The company\\'s first product is the Apple I, a computer designed and hand-built entirely by Wozniak. To finance its creation, Jobs sold his Volkswagen Bus, and Wozniak sold his HP-65 calculator.:\\u200a57\\u200a Neither received the full selling price but in total earned $1,300 (equivalent to $7,000 in 2023). Wozniak debuted the first prototype Apple I at the Homebrew Computer Club in July 1976. The Apple I was sold as a motherboard with CPU, RAM, and basic textual-video chips—a base kit concept which was not yet marketed as a complete personal computer. It was priced soon after debut for $666.66 (equivalent to $3,600 in 2023).:\\u200a180\\u200a Wozniak later said he was unaware of the coincidental mark of the beast in the number 666, ', metadata={'title': 'Apple Inc.', 'summary': 'Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It designs, develops, and sells consumer electronics, computer software, and online services. Devices include the iPhone, iPad, Mac, Apple Watch, Vision Pro, and Apple TV; operating systems include iOS, iPadOS, and macOS; and software applications and services include iTunes, iCloud, Apple Music, and Apple TV+.\\nFor most of 2011 to 2024, Apple became the world\\'s largest company by market capitalization until Microsoft assumed the position in January 2024. In 2022, Apple was the largest technology company by revenue, with US$394.3 billion. As of 2023, Apple was the fourth-largest personal computer vendor by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American information technology companies, alongside Alphabet (the parent company of Google), Amazon, Meta (the parent company of Facebook), and Microsoft.\\nApple was founded as Apple Computer Company on April 1, 1976, to produce and market Steve Wozniak\\'s Apple I personal computer. The company was incorporated by Wozniak and Steve Jobs in 1977. Its second computer, the Apple II, became a best seller as one of the first mass-produced microcomputers. Apple introduced the Lisa in 1983 and the Macintosh in 1984, as some of the first computers to use a graphical user interface and a mouse. By 1985, the company\\'s internal problems included the high cost of its products and power struggles between executives. That year Jobs left Apple to form NeXT, Inc., and Wozniak withdrew to other ventures. The market for personal computers expanded and evolved throughout the 1990s, and Apple lost considerable market share to the lower-priced Wintel duopoly of the Microsoft Windows operating system on Intel-powered PC clones.\\nIn 1997, Apple was weeks away from bankruptcy. To resolve its failed operating system strategy and entice Jobs\\'s return, it bought NeXT. Over the next decade, Jobs guided Apple back to profitability through several tactics including introducing the iMac, iPod, iPhone, and iPad to critical acclaim, launching the \"Think different\" campaign and other memorable advertising campaigns, opening the Apple Store retail chain, and acquiring numerous companies to broaden its product portfolio. Jobs resigned in 2011 for health reasons, and died two months later. He was succeeded as CEO by Tim Cook.\\nApple has received criticism regarding its contractors\\' labor practices, its environmental practices, and its business ethics, including anti-competitive practices and materials sourcing. Nevertheless, it has a large following and a high level of brand loyalty. It has been consistently ranked as one of the world\\'s most valuable brands.\\nApple became the first publicly traded U.S. company to be valued at over $1 trillion in August 2018, then at $2 trillion in August 2020, and at $3 trillion in January 2022. In June 2023, it was valued at just over $3 trillion.', 'source': 'https://en.wikipedia.org/wiki/Apple_Inc.'}),\n",
       " Document(page_content='The Mac, short for Macintosh (its official name until 1999), is a family of personal computers designed and marketed by Apple Inc. The name Macintosh is a reference to a type of apple called McIntosh. The product lineup includes the MacBook Air and MacBook Pro laptops, and the iMac, Mac Mini, Mac Studio, and Mac Pro desktops. Macs are sold with the macOS operating system.\\nJef Raskin conceived the Macintosh project in 1979, which was usurped and redefined by Apple co-founder Steve Jobs in 1981. The Macintosh has a 9-inch monochrome monitor built into the case, and was launched in January 1984, after Apple\\'s \"1984\" advertisement during Super Bowl XVIII.\\nIn 1987, the Macintosh II brought color graphics. From 1994, Power Macintosh transitioned from Motorola 68000 series processors to PowerPC. Through most of the 1990s, the Mac was not fully competitive with commodity IBM PC compatibles.\\nThe 1996 acquisition of NeXT returned Steve Jobs to Apple, whose focused product oversight pushed the Mac mainstream with the 1998 iMac G3, the OS X operating system (renamed to macOS in 2016), and the Mac transition to Intel processors from 2005 to 2006. High pixel density Retina displays debuted in the iPhone 4 in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was reinvigorated with new high-end Macs and the transition to Apple silicon, which had originated in iOS devices.\\n\\n\\n== History ==\\n\\n\\n=== 1979–1996: \"Macintosh\" era ===\\n\\nIn the late 1970s, the Apple II became one of the most popular computers, especially in education. After IBM introduced the IBM PC in 1981, its sales quickly surpassed the Apple II. In response, Apple introduced the Lisa in 1983. The Lisa\\'s graphical user interface was partially inspired by strategically licensed demonstrations of the Xerox Star. Lisa far surpassed the Star with intuitive direct manipulation, like the ability to drag and drop files, double-click to launch applications, and move or resize windows by clicking and dragging instead of going through a menu. However, hampered by its high price of $9,995 (equivalent to $33,000 in 2023) and lack of available software, the Lisa was commercially unsuccessful.\\nParallel to the Lisa\\'s development, a skunkworks team at Apple was working on the Macintosh project. Conceived in 1979 by Jef Raskin, Macintosh was envisioned as an affordable, easy-to-use computer for the masses. Raskin named the computer after his favorite type of apple, the McIntosh. The initial team consisted of Raskin, hardware engineer Burrell Smith, and Apple co-founder Steve Wozniak. In 1981, Steve Jobs was removed from the Lisa team and joined Macintosh, and was able to gradually take control of the project due to Wozniak\\'s temporary absence after an airplane crash. Under Jobs, the Mac grew to resemble the Lisa, with a mouse and a more intuitive graphical interface, at a quarter of the Lisa\\'s price.\\nUpon its January 1984 launch, the first Macintosh was described as revolutionary by The New York Times. Sales initially met projections, but dropped due to the machine\\'s low performance, single floppy disk drive requiring frequent disk swapping, and initial lack of applications. Author Douglas Adams said: \"But what I (and I think everybody else who bought the machine in the early days) fell in love with was not the machine itself, which was ridiculously slow and underpowered, but a romantic idea of the machine. And that romantic idea had to sustain me through the realities of actually working on the 128K Mac.\" Most of the original Macintosh team left Apple, and some followed Jobs to found NeXT after he was forced out by CEO John Sculley. The first Macintosh nevertheless generated cult enthusiasm among buyers and some developers, who rushed to develop entirely new programs for the platform, including PageMaker, MORE, and Excel. Apple soon released the Macintosh 512K with improved performance and an external floppy drive. The Maci', metadata={'title': 'Mac (computer)', 'summary': 'The Mac, short for Macintosh (its official name until 1999), is a family of personal computers designed and marketed by Apple Inc. The name Macintosh is a reference to a type of apple called McIntosh. The product lineup includes the MacBook Air and MacBook Pro laptops, and the iMac, Mac Mini, Mac Studio, and Mac Pro desktops. Macs are sold with the macOS operating system.\\nJef Raskin conceived the Macintosh project in 1979, which was usurped and redefined by Apple co-founder Steve Jobs in 1981. The Macintosh has a 9-inch monochrome monitor built into the case, and was launched in January 1984, after Apple\\'s \"1984\" advertisement during Super Bowl XVIII.\\nIn 1987, the Macintosh II brought color graphics. From 1994, Power Macintosh transitioned from Motorola 68000 series processors to PowerPC. Through most of the 1990s, the Mac was not fully competitive with commodity IBM PC compatibles.\\nThe 1996 acquisition of NeXT returned Steve Jobs to Apple, whose focused product oversight pushed the Mac mainstream with the 1998 iMac G3, the OS X operating system (renamed to macOS in 2016), and the Mac transition to Intel processors from 2005 to 2006. High pixel density Retina displays debuted in the iPhone 4 in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was reinvigorated with new high-end Macs and the transition to Apple silicon, which had originated in iOS devices.', 'source': 'https://en.wikipedia.org/wiki/Mac_(computer)'}),\n",
       " Document(page_content='From 2014 until 2024, Apple Inc. undertook a research and development effort to develop an electric and self-driving car, codenamed \"Project Titan\". Apple never openly discussed any of its automotive research, but around 5,000 employees were reported to be working on the project as of 2018. In May 2018, Apple reportedly partnered with Volkswagen to produce an autonomous employee shuttle van based on the T6 Transporter commercial vehicle platform. In August 2018, the BBC reported that Apple had 66 road-registered driverless cars, with 111 drivers registered to operate those cars. In 2020, it was believed that Apple was still working on self-driving related hardware, software and service as a potential product, instead of actual Apple-branded cars. In December 2020, Reuters reported that Apple was planning on a possible launch date of 2024, but analyst Ming-Chi Kuo claimed it would not be launched before 2025 and might not be launched until 2028 or later. \\nIn February 2024, Apple executives canceled their plans to release the autonomous electric vehicle, instead shifting resources on the project to the company\\'s generative artificial intelligence efforts. The project had reportedly cost the company over $1 billion per year, with other parts of Apple collaborating and costing hundreds of millions of dollars in additional spend. Additionally, over 600 employees were laid off due to the cancellation of the project.\\n\\n\\n== Car details ==\\nThe car project cycled through multiple designs over the years. Teams at Apple outside of the development project were involved in its development. People from the Apple silicon team were heavily involved in the car to design the processor used for its autonomy. At the time of cancelation, the chip was nearly finished, and had the equivalent processing power of four M2 Ultras combined. The microkernel for the car was named \"safetyOS\".\\n\\n\\n== Proposed collaborations and acquisitions ==\\nDuring the 2008–2010 automotive industry crisis, with car companies nearing collapse, Apple SVP Tony Fadell floated to Jobs the idea of buying General Motors on the cheap. The idea was abandoned partly because the company felt that it would be a bad look, and partly because of its focus on the iPhone.\\nFollowing Apple\\'s returned interest in 2014, Apple\\'s head of corporate development Adrian Perica met with Elon Musk several times with an interest in acquiring Tesla, which kicked off the research project. Tim Cook, Apple\\'s CEO, shut down these early negotiations, partly due to Apple\\'s CFO (and former GM Europe CFO) Luca Maestri saying how difficult the car business was. Despite the failure, years later, then-hardware chief Dan Riccio and former Ford engineer and iPhone engineer Steve Zadesky returned to Musk to discuss ideas for a collaboration. A few more years later, as Tesla struggled to make its Model 3 sedan, Musk attempted to restart talks with Apple, but said Cook wouldn\\'t meet.\\nA partnership with Mercedes-Benz was worked on, and was similar to talks with and progressed further than that with Tesla. The plan was for Mercedes-Benz to manufacture the car, and Apple to also provide Mercedes-Benz its self-driving platform and UI for other cars. Apple pulled out partly because it had confidence that it could successfully manufacture a car themselves and partly over disagreements over controlling the user\\'s experience and data. The talks lasted for more than a year.\\nThe closest talks to acquire a car company were with McLaren. Some executives hoped that Jony Ive would be closer to Apple with that acquisition, following his reduced involvement in the company. BMW and Canoo, among others, were also in exploratory talks for an acquisition. Apple also met with Nissan and BYD Auto. Apple was concerned that integrating an automaker would be a disaster internally. Apple briefly partnered with Magna Steyr, a maker of low-volume vehicles for the project.\\nIn 2018, Apple signed a deal with Volkswagen to make an autonomous shuttle for ', metadata={'title': 'Apple car project', 'summary': 'From 2014 until 2024, Apple Inc. undertook a research and development effort to develop an electric and self-driving car, codenamed \"Project Titan\". Apple never openly discussed any of its automotive research, but around 5,000 employees were reported to be working on the project as of 2018. In May 2018, Apple reportedly partnered with Volkswagen to produce an autonomous employee shuttle van based on the T6 Transporter commercial vehicle platform. In August 2018, the BBC reported that Apple had 66 road-registered driverless cars, with 111 drivers registered to operate those cars. In 2020, it was believed that Apple was still working on self-driving related hardware, software and service as a potential product, instead of actual Apple-branded cars. In December 2020, Reuters reported that Apple was planning on a possible launch date of 2024, but analyst Ming-Chi Kuo claimed it would not be launched before 2025 and might not be launched until 2028 or later. \\nIn February 2024, Apple executives canceled their plans to release the autonomous electric vehicle, instead shifting resources on the project to the company\\'s generative artificial intelligence efforts. The project had reportedly cost the company over $1 billion per year, with other parts of Apple collaborating and costing hundreds of millions of dollars in additional spend. Additionally, over 600 employees were laid off due to the cancellation of the project.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Apple_car_project'}),\n",
       " Document(page_content='Apple Maps is a web mapping service developed by Apple Inc. The default map system of iOS, iPadOS, macOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public transportation navigation. A \"Flyover\" mode shows certain urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.\\nFirst released in 2012, Apple Maps replaced Google Maps as the default map system on Apple devices. At launch, it drew criticism from users and reviewers for incorrect directions, sparse data about public transportation, and various other bugs and errors. Apple has since further developed the software to address the issues raised by such criticism.\\nWhile formerly exclusive to Apple devices, Apple released a cross-platform MapKit JS API in 2018, allowing Apple Maps to be embedded on the web.\\n\\n\\n== History ==\\n\\n\\n=== Initial release ===\\n\\nApple revealed that the application would replace Google Maps as the default web mapping service for iOS. Apple also announced that the application would include turn-by-turn navigation, 3D maps, and the virtual assistant Siri. The mapping service was released on September 19, 2012. Following the launch, Apple Maps was heavily criticized, which resulted in a public apology by Apple CEO Tim Cook in late September and the departure of two key employees of Apple (see also §Early inaccuracy).\\nGoogle Maps was the default mapping app in iOS from the first generation iPhone in 2007. In late 2009, tensions between Google and Apple started when the Android version of Google Maps featured turn-by-turn navigation, a feature which the iOS version lacked. At the time, Apple argued that Google collected too much user data. When Apple made iOS 6 available, Google Maps could only be accessed by iOS 6 users via the web. Although Google did not immediately launch an iOS version Maps, shortly after the announcement of Apple Maps, Google did add a Flyover feature to its virtual globe application Google Earth. Three months later, in December 2012, Google Maps was released in the App Store. This version of Google Maps, unlike the previous version, featured turn-by-turn navigation. Shortly after it was launched, it was the most popular free application in the App Store.\\nSpeculation around Apple creating a mapping service of its own arose in 2009 after computer magazine Computerworld reported that Apple had acquired Jaron Waldman\\'s company Placebase, an online mapping service, in July of that year. The CEO of Placebase became a part of Apple\\'s \"Geo Team\". In the following two years, Apple acquired two more mapping related companies who specialized in 3D maps: Poly9 in 2010 and C3 Technologies in 2011. C3 Technologies\\' imagery was later used for the Flyovers feature in Apple Maps. Earlier in 2011, Apple indicated its plan for a mapping service when it stated on its website that it was collecting location data to create \"an improved traffic service in the next couple of years\" for iPhone users. In September 2012, when Apple Maps was released, a \"source\" connected to both Google and Apple Maps claimed to technology website TechCrunch that Apple was recruiting Google employees that worked on Google Maps.\\n\\n\\n=== 2012–2015 ===\\nIn the first year after its release, Apple Maps received a number of improvements which solved various errors in the application. Other changes included adding more satellite imagery and making the navigation available in more cities. In 2013, Apple also acquired a few companies to improve Apple Maps, namely HopStop, Embark, WifiSlam, and Locationary, as well as the team and the technology of the company BroadMap. HopStop and Embark both specialized in mapping public transportation, WifiSlam specialized in interior maps, Locationary provided accurate company data for mapping services, and BroadMap managed, sorted, and analyzed map data.\\nDuring WWDC in June 2013, Apple announced the new version of Apple Maps in iOS 7. This new versi', metadata={'title': 'Apple Maps', 'summary': 'Apple Maps is a web mapping service developed by Apple Inc. The default map system of iOS, iPadOS, macOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public transportation navigation. A \"Flyover\" mode shows certain urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.\\nFirst released in 2012, Apple Maps replaced Google Maps as the default map system on Apple devices. At launch, it drew criticism from users and reviewers for incorrect directions, sparse data about public transportation, and various other bugs and errors. Apple has since further developed the software to address the issues raised by such criticism.\\nWhile formerly exclusive to Apple devices, Apple released a cross-platform MapKit JS API in 2018, allowing Apple Maps to be embedded on the web.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Apple_Maps'}),\n",
       " Document(page_content='The App Store is an app marketplace developed and maintained by Apple Inc., for mobile apps on its iOS and iPadOS operating systems. The store allows users to browse and download approved apps developed within Apple\\'s iOS SDK. Apps can be downloaded on the iPhone, iPod Touch, or iPad, and some can be transferred to the Apple Watch smartwatch or 4th-generation or newer Apple TVs as extensions of iPhone apps.\\nThe App Store opened on July 10, 2008, with an initial 500 applications available. The number of apps peaked at around 2.2 million in 2017, but declined slightly over the next few years as Apple began a process to remove old or 32-bit apps. As of 2021, the store features more than 1.8 million apps.\\nWhile Apple touts the role of the App Store in creating new jobs in the \"app economy\" and claims to have paid over $155 billion to developers, the App Store has also attracted criticism from developers and government regulators that it operates a monopoly and that Apple\\'s 30% cut of revenues from the store is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple\\'s App Store are anti-competitive and would demand that Apple change its in-app payment system policies.\\n\\n\\n== History ==\\n\\nWhile originally developing iPhone prior to its unveiling in 2007, Apple\\'s then-CEO Steve Jobs did not intend to let third-party developers build native apps for iOS, instead directing them to make web applications for the Safari web browser. However, backlash from developers prompted the company to reconsider, with Jobs announcing in October 2007 that Apple would have a software development kit available for developers by February 2008. The SDK was released on March 6, 2008.\\nThe iPhone App Store opened on July 10, 2008. On July 11, the iPhone 3G was released and came pre-loaded with support for App Store. Initially apps could be free or paid, but then in 2009, Apple added the ability to add in-app purchases which quickly became the dominant way to monetize apps, especially games.\\nAfter the success of Apple\\'s App Store and the launch of similar services by its competitors, the term \"app store\" has been adopted to refer to any similar service for mobile devices. However, Apple applied for a U.S. trademark on the term \"App Store\" in 2008, which was tentatively approved in early 2011. In June 2011, U.S. District Judge Phyllis Hamilton, who was presiding over Apple\\'s case against Amazon, said she would \"probably\" deny Apple\\'s motion to stop Amazon from using the \"App Store\" name. In July, Apple was denied preliminary injunction against Amazon\\'s Appstore by a federal judge.\\nThe term app has become a popular buzzword; in January 2011, app was awarded the honor of being 2010\\'s \"Word of the Year\" by the American Dialect Society. \"App\" has been used as shorthand for \"application\" since at least the late 1970s, and in product names since at least 2006, for example then-named Google Apps.\\nApple announced Mac App Store, a similar app distribution platform for its macOS personal computer operating system, in October 2010, with the official launch taking place in January 2011 with the release of its 10.6.6 \"Snow Leopard\" update.\\nIn February 2013, Apple informed developers that they could begin using appstore.com for links to their apps. In June at its developer conference, Apple announced an upcoming \"Kids\" section in App Store, a new section featuring apps categorized by age range, and the section was launched alongside the release of iOS 7 in September 2013.\\nIn 2016, multiple media outlets reported that apps had decreased significantly in popularity. Recode wrote that \"The app boom is over\", an editorial in TechCrunch stated that \"The air of hopelessness that surrounds the mobile app ecosystem is obvious and demoralizing\", and The Verge wrote that \"the original App Store model of selling apps for a buck or two looks antiquated\". Issues included consumer \"boredom\", a lack of app discoverabi', metadata={'title': 'App Store (Apple)', 'summary': 'The App Store is an app marketplace developed and maintained by Apple Inc., for mobile apps on its iOS and iPadOS operating systems. The store allows users to browse and download approved apps developed within Apple\\'s iOS SDK. Apps can be downloaded on the iPhone, iPod Touch, or iPad, and some can be transferred to the Apple Watch smartwatch or 4th-generation or newer Apple TVs as extensions of iPhone apps.\\nThe App Store opened on July 10, 2008, with an initial 500 applications available. The number of apps peaked at around 2.2 million in 2017, but declined slightly over the next few years as Apple began a process to remove old or 32-bit apps. As of 2021, the store features more than 1.8 million apps.\\nWhile Apple touts the role of the App Store in creating new jobs in the \"app economy\" and claims to have paid over $155 billion to developers, the App Store has also attracted criticism from developers and government regulators that it operates a monopoly and that Apple\\'s 30% cut of revenues from the store is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple\\'s App Store are anti-competitive and would demand that Apple change its in-app payment system policies.', 'source': 'https://en.wikipedia.org/wiki/App_Store_(Apple)'}),\n",
       " Document(page_content='Apple TV is a digital media player and microconsole developed and marketed by Apple Inc. It is a small piece of networking hardware that sends received media data such as video and audio to a TV or external display. Its media services include streaming media, TV Everywhere-based services, local media sources, and sports journalism and broadcasts.\\nSecond-generation and later models function only when connected via HDMI to an enhanced-definition or high-definition widescreen television. Since the fourth-generation model, Apple TV runs tvOS with multiple pre-installed apps.  In November 2019, Apple released Apple TV+ and Apple TV app a la carte.\\nApple TV lacks integrated controls and can only be controlled remotely, through a Siri Remote, iPhone or iPad, Apple Remote, or third-party infrared remotes complying with the fourth generation  Consumer Electronics Control standard.\\n\\n\\n== Background ==\\n\\nBefore the Apple TV, Apple made a number of attempts to create TV-based devices: In 1993, Apple released the Macintosh TV in an attempt to enter the home-entertainment industry. The device had a 14-inch CRT screen and a TV tuner card. It was not a commercial success, with only 10,000 sold before its discontinuation in 1994. That year, the company developed the Apple Interactive Television Box, a collaboration with BT Group and Proximus Group that was never released to the public. Apple\\'s final major attempt before the Apple TV was the Apple Pippin in 1990s, a combination home game console and networked computer.\\n\\n\\n== Models ==\\n\\n\\n=== First generation ===\\n\\nAt a September 2006 Apple special event, Apple announced the first-generation Apple TV. It was originally announced as \"iTV\" to fit into their \"i\"-based product naming convention, but was renamed \"Apple TV\" before launch due to a trademark dispute with British broadcasting network ITV, which threatened legal action against Apple. Pre-orders began in January 2007 and it was released in March 2007. It is based on a Pentium M processor and ran a variant of Mac OS X Tiger, and included a 40 GB hard disk for storing content. It supported output up to 720p on HDTVs via HDMI, and supported some standard definition televisions via component video. At launch, Apple TV required a Mac or Windows-based PC running iTunes on the same network to sync or stream content to it.\\nA model with a 160 GB hard drive was released in May 2007. The 40 GB version was discontinued in September 2009. In January 2008, it became a stand-alone device through a software update, which removed the requirement of iTunes syncing from separate computer, and allowed for media from services such as iTunes Store, MobileMe, and Flickr to be rented or purchased directly on the Apple TV.\\nIn July 2008, Apple released the software 2.1 update which added external recognition of iPhones and iPod Touches as alternative remote control devices to the Apple Remote. In September 2015, Apple discontinued iTunes support for the first-generation Apple TV, with accessibility being obstructed from such devices due to obsolete security standards.\\nThe first generation Apple TV can be modified into a makeshift intel Mac Mini, with a USB boot disk image being available online, and an install to the inbuilt hard drive possible by flashing the image to the hard drive through the USB booted disk. The device is not easily used unless a USB hub is installed, due to it only having one USB port.\\nThe first generation Apple TV has a 1 GHz Intel Pentium M CPU, and 256 MB of RAM. Neither the CPU or RAM can be upgraded without soldering, as both are soldered onto the motherboard. The device has one HDMI interface, one USB port, one 10/100 base T Ethernet port, and a Component video interface. Due to its thermal management design utilizing the upper case as a passive heat sink, the device gets warm when in use. A fan is used to cool the case, but it does not reach the CPU and is instead installed to cool the hard drive and installed power supply.\\n\\n\\n=== Second gene', metadata={'title': 'Apple TV', 'summary': 'Apple TV is a digital media player and microconsole developed and marketed by Apple Inc. It is a small piece of networking hardware that sends received media data such as video and audio to a TV or external display. Its media services include streaming media, TV Everywhere-based services, local media sources, and sports journalism and broadcasts.\\nSecond-generation and later models function only when connected via HDMI to an enhanced-definition or high-definition widescreen television. Since the fourth-generation model, Apple TV runs tvOS with multiple pre-installed apps.  In November 2019, Apple released Apple TV+ and Apple TV app a la carte.\\nApple TV lacks integrated controls and can only be controlled remotely, through a Siri Remote, iPhone or iPad, Apple Remote, or third-party infrared remotes complying with the fourth generation  Consumer Electronics Control standard.\\n\\n', 'source': 'https://en.wikipedia.org/wiki/Apple_TV'}),\n",
       " Document(page_content='Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology giant Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder of Pixar. He was a pioneer of the personal computer revolution of the 1970s and 1980s, along with his early business partner and fellow Apple co-founder Steve Wozniak.\\nJobs was born in San Francisco in 1955 and adopted shortly afterwards. He attended Reed College in 1972 before withdrawing that same year. In 1974, he traveled through India, seeking enlightenment before later studying Zen Buddhism. He and Wozniak co-founded Apple in 1976 to further develop and sell Wozniak\\'s Apple I personal computer. Together, the duo gained fame and wealth a year later with production and sale of the Apple II, one of the first highly successful mass-produced microcomputers. Jobs saw the commercial potential of the Xerox Alto in 1979, which was mouse-driven and had a graphical user interface (GUI). This led to the development of the unsuccessful Apple Lisa in 1983, followed by the breakthrough Macintosh in 1984, the first mass-produced computer with a GUI. The Macintosh launched the desktop publishing industry in 1985 with the addition of the Apple LaserWriter, the first laser printer to feature vector graphics and PostScript.\\nIn 1985, Jobs departed Apple after a long power struggle with the company\\'s board and its then-CEO, John Sculley. That same year, Jobs took some Apple employees with him to found NeXT, a computer platform development company that specialized in computers for higher-education and business markets, serving as its CEO. In 1986, he helped develop the visual effects industry by funding the computer graphics division of Lucasfilm that eventually spun off independently as Pixar, which produced the first 3D computer-animated feature film Toy Story (1995) and became a leading animation studio, producing over 27 films since.\\nIn 1997, Jobs returned to Apple as CEO after the company\\'s acquisition of NeXT. He was largely responsible for reviving Apple, which was on the verge of bankruptcy. He worked closely with British designer Jony Ive to develop a line of products and services that had larger cultural ramifications, beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes Store, iPhone, App Store, and iPad. In 2003, Jobs was diagnosed with a pancreatic neuroendocrine tumor. He died of respiratory arrest related to the tumor in 2011, and in 2022, was posthumously awarded the Presidential Medal of Freedom.\\n\\n\\n== Early life ==\\n\\n\\n=== Family ===\\nSteven Paul Jobs was born in San Francisco, California, on February 24, 1955, to Joanne Carole Schieble and Abdulfattah \"John\" Jandali (Arabic: عبد الفتاح الجندلي). Abdulfattah Jandali was born in a Muslim household to wealthy Syrian parents, the youngest of nine siblings. After obtaining his undergraduate degree at the American University of Beirut, Jandali pursued a PhD in political science at the University of Wisconsin. There, he met Joanne Schieble, an American Catholic of Swiss-German descent whose parents owned a mink farm and real estate in Green Bay. The two fell in love but faced opposition from Schieble\\'s father due to Jandali\\'s Muslim faith. When Schieble became pregnant, she arranged for a closed adoption, and travelled to San Francisco to give birth.\\nSchieble requested that her son be adopted by college graduates. A lawyer and his wife were selected, but they withdrew after discovering that the baby was a boy, so Jobs was instead adopted by Paul Reinhold and Clara (née Hagopian) Jobs. Paul Jobs, an American of German descent, was the son of a dairy farmer from Washington County, Wisconsin. After dropping out of high school, he worked as a mechanic, then joined the US Coast Guard. When his ship was decommissioned at San Francisco, he bet he could find a wife within 2 weeks. He th', metadata={'title': 'Steve Jobs', 'summary': 'Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology giant Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder of Pixar. He was a pioneer of the personal computer revolution of the 1970s and 1980s, along with his early business partner and fellow Apple co-founder Steve Wozniak.\\nJobs was born in San Francisco in 1955 and adopted shortly afterwards. He attended Reed College in 1972 before withdrawing that same year. In 1974, he traveled through India, seeking enlightenment before later studying Zen Buddhism. He and Wozniak co-founded Apple in 1976 to further develop and sell Wozniak\\'s Apple I personal computer. Together, the duo gained fame and wealth a year later with production and sale of the Apple II, one of the first highly successful mass-produced microcomputers. Jobs saw the commercial potential of the Xerox Alto in 1979, which was mouse-driven and had a graphical user interface (GUI). This led to the development of the unsuccessful Apple Lisa in 1983, followed by the breakthrough Macintosh in 1984, the first mass-produced computer with a GUI. The Macintosh launched the desktop publishing industry in 1985 with the addition of the Apple LaserWriter, the first laser printer to feature vector graphics and PostScript.\\nIn 1985, Jobs departed Apple after a long power struggle with the company\\'s board and its then-CEO, John Sculley. That same year, Jobs took some Apple employees with him to found NeXT, a computer platform development company that specialized in computers for higher-education and business markets, serving as its CEO. In 1986, he helped develop the visual effects industry by funding the computer graphics division of Lucasfilm that eventually spun off independently as Pixar, which produced the first 3D computer-animated feature film Toy Story (1995) and became a leading animation studio, producing over 27 films since.\\nIn 1997, Jobs returned to Apple as CEO after the company\\'s acquisition of NeXT. He was largely responsible for reviving Apple, which was on the verge of bankruptcy. He worked closely with British designer Jony Ive to develop a line of products and services that had larger cultural ramifications, beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes Store, iPhone, App Store, and iPad. In 2003, Jobs was diagnosed with a pancreatic neuroendocrine tumor. He died of respiratory arrest related to the tumor in 2011, and in 2022, was posthumously awarded the Presidential Medal of Freedom.', 'source': 'https://en.wikipedia.org/wiki/Steve_Jobs'}),\n",
       " Document(page_content='The iPhone is a line of smartphones produced by Apple Inc. that use Apple\\'s own iOS mobile operating system. The first-generation iPhone was announced by then–Apple CEO Steve Jobs on January 9, 2007. Since then, Apple has annually released new iPhone models and iOS updates. As of November 1, 2018, more than 2.2 billion iPhones had been sold.\\nThe iPhone was the first mobile phone to use multi-touch technology. Since the iPhone\\'s launch, it has gained larger screen sizes, video-recording, waterproofing, and many accessibility features. Up to the iPhone 8 and 8 Plus, iPhones had a single button on the front panel, with the iPhone 5s and later integrating a Touch ID fingerprint sensor. Since the iPhone X, iPhone models have switched to a nearly bezel-less front screen design with Face ID facial recognition, and app switching activated by gestures. Touch ID is still used for the budget iPhone SE series.\\nThe iPhone is one of the two largest smartphone platforms in the world alongside Android, and is a large part of the luxury market. The iPhone has generated large profits for Apple, making it one of the world\\'s most valuable publicly traded companies. The first-generation iPhone was described as a \"revolution\" for the mobile phone industry and subsequent models have also garnered praise. The iPhone has been credited with popularizing the smartphone and slate form factor, and with creating a large market for smartphone apps, or \"app economy\". As of January 2017, Apple\\'s App Store contained more than 2.2 million applications for the iPhone.\\n\\n\\n== History ==\\n\\nDevelopment of an Apple smartphone began in 2004, when Apple started to gather a team of 1,000 employees led by hardware engineer Tony Fadell, software engineer Scott Forstall, and design officer Jony Ive, to work on the highly confidential \"Project Purple\".\\nThen-Apple CEO Steve Jobs steered the original focus away from a tablet (which was later revisited in the form of the iPad) towards a phone. Apple created the device during a secretive collaboration with Cingular Wireless (later renamed AT&T Mobility) at an estimated development cost of US$150 million over thirty months. According to Jobs in 1998, the \"i\" word in \"iMac\" (and thereafter \"iPod\", \"iPhone\" and \"iPad\") stands for internet, individual, instruct, inform, and inspire.\\nApple rejected the \"design by committee\" approach that had yielded the Motorola ROKR E1, a largely unsuccessful \"iTunes phone\" made in collaboration with Motorola. Among other deficiencies, the ROKR E1\\'s firmware limited storage to only 100 iTunes songs to avoid competing with Apple\\'s iPod nano. Cingular gave Apple the liberty to develop the iPhone\\'s hardware and software in-house, a rare practice at the time, and paid Apple a fraction of its monthly service revenue (until the iPhone 3G), in exchange for four years of exclusive U.S. sales, until 2011.\\nJobs unveiled the first-generation iPhone to the public on January 9, 2007, at the Macworld 2007 convention at the Moscone Center in San Francisco. The iPhone incorporated a 3.5-inch multi-touch display with few hardware buttons, and ran the iPhone OS operating system with a touch-friendly interface, then marketed as a version of Mac OS X. It launched on June 29, 2007, at a starting price of US$499 in the United States, and required a two-year contract with AT&T.\\n\\nOn July 11, 2008, at Apple\\'s Worldwide Developers Conference (WWDC) 2008, Apple announced the iPhone 3G, and expanded its launch-day availability to twenty-two countries, and it was eventually released in 70 countries and territories. The iPhone 3G introduced faster 3G connectivity, and a lower starting price of US$199 (with a two-year AT&T contract). It proved commercially popular, overtaking Motorola RAZR V3 as the best selling cell phone in the US by the end of 2008. Its successor, the iPhone 3GS, was announced on June 8, 2009, at WWDC 2009, and introduced video recording functionality.\\n\\nThe iPhone 4 was announced on June 7, 2010, at WWDC 2010, ', metadata={'title': 'IPhone', 'summary': 'The iPhone is a line of smartphones produced by Apple Inc. that use Apple\\'s own iOS mobile operating system. The first-generation iPhone was announced by then–Apple CEO Steve Jobs on January 9, 2007. Since then, Apple has annually released new iPhone models and iOS updates. As of November 1, 2018, more than 2.2 billion iPhones had been sold.\\nThe iPhone was the first mobile phone to use multi-touch technology. Since the iPhone\\'s launch, it has gained larger screen sizes, video-recording, waterproofing, and many accessibility features. Up to the iPhone 8 and 8 Plus, iPhones had a single button on the front panel, with the iPhone 5s and later integrating a Touch ID fingerprint sensor. Since the iPhone X, iPhone models have switched to a nearly bezel-less front screen design with Face ID facial recognition, and app switching activated by gestures. Touch ID is still used for the budget iPhone SE series.\\nThe iPhone is one of the two largest smartphone platforms in the world alongside Android, and is a large part of the luxury market. The iPhone has generated large profits for Apple, making it one of the world\\'s most valuable publicly traded companies. The first-generation iPhone was described as a \"revolution\" for the mobile phone industry and subsequent models have also garnered praise. The iPhone has been credited with popularizing the smartphone and slate form factor, and with creating a large market for smartphone apps, or \"app economy\". As of January 2017, Apple\\'s App Store contained more than 2.2 million applications for the iPhone.', 'source': 'https://en.wikipedia.org/wiki/IPhone'})]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_raw_documents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Document(page_content=\"Timothy Donald Cook (born November 1, 1960) is an American business executive who is the current chief executive officer of Apple Inc. Cook had previously been the company's chief operating officer under its co-founder Steve Jobs. Cook joined Apple in March 1998 as a senior vice president for worldwide operations, and then as executive vice president for worldwide sales and operations. He was appointed chief executive on August 24, 2011 after Jobs, who was ill and died that October, resigned. During his tenure as the chief executive, he has advocated for the political reform of international and domestic surveillance, cybersecurity, American manufacturing, and environmental preservation. Since 2011 when he took over Apple, to 2020, Cook doubled the company's revenue and profit, and the company's market value increased from $348 billion to $1.9 trillion. Cook is also on the boards of directors of Nike, Inc. and the National Football Foundation; he is a trustee of Duke University, his alma mater. Outside of Apple, Cook engages in philanthropy; in March 2015 he said he planned to donate his fortune to charity. In 2014, Cook became the first chief executive of a Fortune 500 company to publicly come out as gay. Early life and education Timothy Donald Cook was born on November 1, 1960, in Mobile, Alabama. He was baptized in a Baptist church and grew up in nearby Robertsdale. His father, Donald Cook, was a shipyard worker, and his mother, Geraldine Cook, worked at a pharmacy. Cook graduated salutatorian from Robertsdale High School in Alabama in 1978. He earned a Bachelor of Science degree with a major in industrial engineering from Auburn University in 1982 and a Master of Business Administration degree from Duke University in 1988. Career = Pre-Apple era =After graduating from Auburn University, Cook spent twelve years in IBM's personal computer business, ultimately as director of North American fulfillment. During this time, Cook also earned his MBA from Duke University, becoming a Fuqua Scholar in 1988. Later, he was the chief operating officer of the computer reseller division of Intelligent Electronics. In 1997, he became the vice president for corporate materials at Compaq, but took up his position at Apple six months later.= Apple era = Early career In 1998, Steve Jobs asked Cook to join Apple. In a commencement speech at Auburn University, Cook said he decided to join Apple after meeting Jobs:Any purely rational consideration of cost and benefits lined up in Compaq's favor, and the people who\"),\n",
       " Document(page_content='said he decided to join Apple after meeting Jobs:Any purely rational consideration of cost and benefits lined up in Compaq\\'s favor, and the people who knew me best advised me to stay at Compaq... On that day in early 1998, I listened to my intuition, not the left side of my brain or for that matter even the people who knew me best... no more than five minutes into my initial interview with Steve, I wanted to throw caution and logic to the wind and join Apple. My intuition already knew that joining Apple was a once-in-a-lifetime opportunity to work for the creative genius and to be on the executive team that could resurrect a great American company.His first position was senior vice president for worldwide operations. Cook closed factories and warehouses, and replaced them with contract manufacturers; this resulted in a reduction of the company\\'s inventory from months to days. Predicting its importance, his group had invested in long-term deals such as advance investment in flash memory since 2005. This guaranteed a stable supply of what became the iPod Nano, then iPhone and iPad. Competitors at Hewlett-Packard described their cancelled HP TouchPad tablet computer and later said that it was made from \"cast-off, reject iPad parts\". Cook\\'s actions were recognized for keeping costs under control, and combined with the rest of the company, generated huge profits.In January 2007, Cook was promoted to lead operations and was chief executive in 2009, while Jobs, in failing health, was away on a leave of absence. In January 2011, Apple\\'s board of Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It designs, develops, and sells consumer electronics, computer software, and online services. Devices include the iPhone, iPad, Mac, Apple Watch, Vision Pro, and Apple TV; operating systems include iOS, iPadOS, and macOS; and software applications and services include iTunes, iCloud, Apple Music, and Apple TV+.For most of 2011 to 2024, Apple became the world\\'s largest company by market capitalization until Microsoft assumed the position in January 2024. In 2022, Apple was the largest technology company by revenue, with US$394.3 billion. As of 2023, Apple was the fourth-largest personal computer vendor by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American'),\n",
       " Document(page_content='by unit sales, the largest manufacturing company by revenue, and the largest vendor of mobile phones in the world. It is one of the Big Five American information technology companies, alongside Alphabet (the parent company of Google), Amazon, Meta (the parent company of Facebook), and Microsoft.Apple was founded as Apple Computer Company on April 1, 1976, to produce and market Steve Wozniak\\'s Apple I personal computer. The company was incorporated by Wozniak and Steve Jobs in 1977. Its second computer, the Apple II, became a best seller as one of the first mass-produced microcomputers. Apple introduced the Lisa in 1983 and the Macintosh in 1984, as some of the first computers to use a graphical user interface and a mouse. By 1985, the company\\'s internal problems included the high cost of its products and power struggles between executives. That year Jobs left Apple to form NeXT, Inc., and Wozniak withdrew to other ventures. The market for personal computers expanded and evolved throughout the 1990s, and Apple lost considerable market share to the lower-priced Wintel duopoly of the Microsoft Windows operating system on Intel-powered PC clones.In 1997, Apple was weeks away from bankruptcy. To resolve its failed operating system strategy and entice Jobs\\'s return, it bought NeXT. Over the next decade, Jobs guided Apple back to profitability through several tactics including introducing the iMac, iPod, iPhone, and iPad to critical acclaim, launching the \"Think different\" campaign and other memorable advertising campaigns, opening the Apple Store retail chain, and acquiring numerous companies to broaden its product portfolio. Jobs resigned in 2011 for health reasons, and died two months later. He was succeeded as CEO by Tim Cook.Apple has received criticism regarding its contractors\\' labor practices, its environmental practices, and its business ethics, including anti-competitive practices and materials sourcing. Nevertheless, it has a large following and a high level of brand loyalty. It has been consistently ranked as one of the world\\'s most valuable brands.Apple became the first publicly traded U.S. company to be valued at over $1 trillion in August 2018, then at $2 trillion in August 2020, and at $3 trillion in January 2022. In June 2023, it was valued at just over $3 trillion. History = 1976–1980: Founding and incorporation =Apple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership.'),\n",
       " Document(page_content='incorporation =Apple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership. The company\\'s first product is the Apple I, a computer designed and hand-built entirely by Wozniak. To finance its creation, Jobs sold his Volkswagen Bus, and Wozniak sold his HP-65 calculator.:\\u200a57\\u200a Neither received the full selling price but in total earned $1,300 (equivalent to $7,000 in 2023). Wozniak debuted the first prototype Apple I at the Homebrew Computer Club in July 1976. The Apple I was sold as a motherboard with CPU, RAM, and basic textual-video chips—a base kit concept which was not yet marketed as a complete personal computer. It was priced soon after debut for $666.66 (equivalent to $3,600 in 2023).:\\u200a180\\u200a Wozniak later said he was unaware of the coincidental mark of the beast in the number 666,  The Mac, short for Macintosh (its official name until 1999), is a family of personal computers designed and marketed by Apple Inc. The name Macintosh is a reference to a type of apple called McIntosh. The product lineup includes the MacBook Air and MacBook Pro laptops, and the iMac, Mac Mini, Mac Studio, and Mac Pro desktops. Macs are sold with the macOS operating system.Jef Raskin conceived the Macintosh project in 1979, which was usurped and redefined by Apple co-founder Steve Jobs in 1981. The Macintosh has a 9-inch monochrome monitor built into the case, and was launched in January 1984, after Apple\\'s \"1984\" advertisement during Super Bowl XVIII.In 1987, the Macintosh II brought color graphics. From 1994, Power Macintosh transitioned from Motorola 68000 series processors to PowerPC. Through most of the 1990s, the Mac was not fully competitive with commodity IBM PC compatibles.The 1996 acquisition of NeXT returned Steve Jobs to Apple, whose focused product oversight pushed the Mac mainstream with the 1998 iMac G3, the OS X operating system (renamed to macOS in 2016), and the Mac transition to Intel processors from 2005 to 2006. High pixel density Retina displays debuted in the iPhone 4 in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was'),\n",
       " Document(page_content='in 2010 and the MacBook Pro in 2012. In the 2010s, the Mac was neglected under CEO Tim Cook, especially for professional users, but was reinvigorated with new high-end Macs and the transition to Apple silicon, which had originated in iOS devices. History = 1979–1996: \"Macintosh\" era =In the late 1970s, the Apple II became one of the most popular computers, especially in education. After IBM introduced the IBM PC in 1981, its sales quickly surpassed the Apple II. In response, Apple introduced the Lisa in 1983. The Lisa\\'s graphical user interface was partially inspired by strategically licensed demonstrations of the Xerox Star. Lisa far surpassed the Star with intuitive direct manipulation, like the ability to drag and drop files, double-click to launch applications, and move or resize windows by clicking and dragging instead of going through a menu. However, hampered by its high price of $9,995 (equivalent to $33,000 in 2023) and lack of available software, the Lisa was commercially unsuccessful.Parallel to the Lisa\\'s development, a skunkworks team at Apple was working on the Macintosh project. Conceived in 1979 by Jef Raskin, Macintosh was envisioned as an affordable, easy-to-use computer for the masses. Raskin named the computer after his favorite type of apple, the McIntosh. The initial team consisted of Raskin, hardware engineer Burrell Smith, and Apple co-founder Steve Wozniak. In 1981, Steve Jobs was removed from the Lisa team and joined Macintosh, and was able to gradually take control of the project due to Wozniak\\'s temporary absence after an airplane crash. Under Jobs, the Mac grew to resemble the Lisa, with a mouse and a more intuitive graphical interface, at a quarter of the Lisa\\'s price.Upon its January 1984 launch, the first Macintosh was described as revolutionary by The New York Times. Sales initially met projections, but dropped due to the machine\\'s low performance, single floppy disk drive requiring frequent disk swapping, and initial lack of applications. Author Douglas Adams said: \"But what I (and I think everybody else who bought the machine in the early days) fell in love with was not the machine itself, which was ridiculously slow and underpowered, but a romantic idea of the machine. And that romantic idea had to sustain me through the realities of actually working on the 128K Mac.\" Most of the original Macintosh team left'),\n",
       " Document(page_content='the machine. And that romantic idea had to sustain me through the realities of actually working on the 128K Mac.\" Most of the original Macintosh team left Apple, and some followed Jobs to found NeXT after he was forced out by CEO John Sculley. The first Macintosh nevertheless generated cult enthusiasm among buyers and some developers, who rushed to develop entirely new programs for the platform, including PageMaker, MORE, and Excel. Apple soon released the Macintosh 512K with improved performance and an external floppy drive. The Maci From 2014 until 2024, Apple Inc. undertook a research and development effort to develop an electric and self-driving car, codenamed \"Project Titan\". Apple never openly discussed any of its automotive research, but around 5,000 employees were reported to be working on the project as of 2018. In May 2018, Apple reportedly partnered with Volkswagen to produce an autonomous employee shuttle van based on the T6 Transporter commercial vehicle platform. In August 2018, the BBC reported that Apple had 66 road-registered driverless cars, with 111 drivers registered to operate those cars. In 2020, it was believed that Apple was still working on self-driving related hardware, software and service as a potential product, instead of actual Apple-branded cars. In December 2020, Reuters reported that Apple was planning on a possible launch date of 2024, but analyst Ming-Chi Kuo claimed it would not be launched before 2025 and might not be launched until 2028 or later. In February 2024, Apple executives canceled their plans to release the autonomous electric vehicle, instead shifting resources on the project to the company\\'s generative artificial intelligence efforts. The project had reportedly cost the company over $1 billion per year, with other parts of Apple collaborating and costing hundreds of millions of dollars in additional spend. Additionally, over 600 employees were laid off due to the cancellation of the project. Car details The car project cycled through multiple designs over the years. Teams at Apple outside of the development project were involved in its development. People from the Apple silicon team were heavily involved in the car to design the processor used for its autonomy. At the time of cancelation, the chip was nearly finished, and had the equivalent processing power of four M2 Ultras combined. The microkernel for the car was named \"safetyOS\". Proposed collaborations and acquisitions During the 2008–2010 automotive industry crisis, with car companies nearing collapse, Apple SVP Tony Fadell floated to Jobs the idea of buying General Motors on'),\n",
       " Document(page_content='2008–2010 automotive industry crisis, with car companies nearing collapse, Apple SVP Tony Fadell floated to Jobs the idea of buying General Motors on the cheap. The idea was abandoned partly because the company felt that it would be a bad look, and partly because of its focus on the iPhone.Following Apple\\'s returned interest in 2014, Apple\\'s head of corporate development Adrian Perica met with Elon Musk several times with an interest in acquiring Tesla, which kicked off the research project. Tim Cook, Apple\\'s CEO, shut down these early negotiations, partly due to Apple\\'s CFO (and former GM Europe CFO) Luca Maestri saying how difficult the car business was. Despite the failure, years later, then-hardware chief Dan Riccio and former Ford engineer and iPhone engineer Steve Zadesky returned to Musk to discuss ideas for a collaboration. A few more years later, as Tesla struggled to make its Model 3 sedan, Musk attempted to restart talks with Apple, but said Cook wouldn\\'t meet.A partnership with Mercedes-Benz was worked on, and was similar to talks with and progressed further than that with Tesla. The plan was for Mercedes-Benz to manufacture the car, and Apple to also provide Mercedes-Benz its self-driving platform and UI for other cars. Apple pulled out partly because it had confidence that it could successfully manufacture a car themselves and partly over disagreements over controlling the user\\'s experience and data. The talks lasted for more than a year.The closest talks to acquire a car company were with McLaren. Some executives hoped that Jony Ive would be closer to Apple with that acquisition, following his reduced involvement in the company. BMW and Canoo, among others, were also in exploratory talks for an acquisition. Apple also met with Nissan and BYD Auto. Apple was concerned that integrating an automaker would be a disaster internally. Apple briefly partnered with Magna Steyr, a maker of low-volume vehicles for the project.In 2018, Apple signed a deal with Volkswagen to make an autonomous shuttle for  Apple Maps is a web mapping service developed by Apple Inc. The default map system of iOS, iPadOS, macOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public transportation navigation. A \"Flyover\" mode shows certain urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.First released in 2012, Apple Maps replaced Google Maps'),\n",
       " Document(page_content='urban centers and other places of interest in a 3D landscape composed of models of buildings and structures.First released in 2012, Apple Maps replaced Google Maps as the default map system on Apple devices. At launch, it drew criticism from users and reviewers for incorrect directions, sparse data about public transportation, and various other bugs and errors. Apple has since further developed the software to address the issues raised by such criticism.While formerly exclusive to Apple devices, Apple released a cross-platform MapKit JS API in 2018, allowing Apple Maps to be embedded on the web. History = Initial release =Apple revealed that the application would replace Google Maps as the default web mapping service for iOS. Apple also announced that the application would include turn-by-turn navigation, 3D maps, and the virtual assistant Siri. The mapping service was released on September 19, 2012. Following the launch, Apple Maps was heavily criticized, which resulted in a public apology by Apple CEO Tim Cook in late September and the departure of two key employees of Apple (see also §Early inaccuracy).Google Maps was the default mapping app in iOS from the first generation iPhone in 2007. In late 2009, tensions between Google and Apple started when the Android version of Google Maps featured turn-by-turn navigation, a feature which the iOS version lacked. At the time, Apple argued that Google collected too much user data. When Apple made iOS 6 available, Google Maps could only be accessed by iOS 6 users via the web. Although Google did not immediately launch an iOS version Maps, shortly after the announcement of Apple Maps, Google did add a Flyover feature to its virtual globe application Google Earth. Three months later, in December 2012, Google Maps was released in the App Store. This version of Google Maps, unlike the previous version, featured turn-by-turn navigation. Shortly after it was launched, it was the most popular free application in the App Store.Speculation around Apple creating a mapping service of its own arose in 2009 after computer magazine Computerworld reported that Apple had acquired Jaron Waldman\\'s company Placebase, an online mapping service, in July of that year. The CEO of Placebase became a part of Apple\\'s \"Geo Team\". In the following two years, Apple acquired two more mapping related companies who specialized in 3D maps: Poly9 in 2010 and C3 Technologies in 2011. C3 Technologies\\' imagery was later used for the Flyovers feature in Apple Maps. Earlier in 2011, Apple indicated its'),\n",
       " Document(page_content='C3 Technologies in 2011. C3 Technologies\\' imagery was later used for the Flyovers feature in Apple Maps. Earlier in 2011, Apple indicated its plan for a mapping service when it stated on its website that it was collecting location data to create \"an improved traffic service in the next couple of years\" for iPhone users. In September 2012, when Apple Maps was released, a \"source\" connected to both Google and Apple Maps claimed to technology website TechCrunch that Apple was recruiting Google employees that worked on Google Maps.= 2012–2015 =In the first year after its release, Apple Maps received a number of improvements which solved various errors in the application. Other changes included adding more satellite imagery and making the navigation available in more cities. In 2013, Apple also acquired a few companies to improve Apple Maps, namely HopStop, Embark, WifiSlam, and Locationary, as well as the team and the technology of the company BroadMap. HopStop and Embark both specialized in mapping public transportation, WifiSlam specialized in interior maps, Locationary provided accurate company data for mapping services, and BroadMap managed, sorted, and analyzed map data.During WWDC in June 2013, Apple announced the new version of Apple Maps in iOS 7. This new versi The App Store is an app marketplace developed and maintained by Apple Inc., for mobile apps on its iOS and iPadOS operating systems. The store allows users to browse and download approved apps developed within Apple\\'s iOS SDK. Apps can be downloaded on the iPhone, iPod Touch, or iPad, and some can be transferred to the Apple Watch smartwatch or 4th-generation or newer Apple TVs as extensions of iPhone apps.The App Store opened on July 10, 2008, with an initial 500 applications available. The number of apps peaked at around 2.2 million in 2017, but declined slightly over the next few years as Apple began a process to remove old or 32-bit apps. As of 2021, the store features more than 1.8 million apps.While Apple touts the role of the App Store in creating new jobs in the \"app economy\" and claims to have paid over $155 billion to developers, the App Store has also attracted criticism from developers and government regulators that it operates a monopoly and that Apple\\'s 30% cut of revenues from the store is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple\\'s App Store are'),\n",
       " Document(page_content='is excessive. In October 2021, the Netherlands Authority for Consumers and Markets (ACM) concluded that in-app commissions from Apple\\'s App Store are anti-competitive and would demand that Apple change its in-app payment system policies. History While originally developing iPhone prior to its unveiling in 2007, Apple\\'s then-CEO Steve Jobs did not intend to let third-party developers build native apps for iOS, instead directing them to make web applications for the Safari web browser. However, backlash from developers prompted the company to reconsider, with Jobs announcing in October 2007 that Apple would have a software development kit available for developers by February 2008. The SDK was released on March 6, 2008.The iPhone App Store opened on July 10, 2008. On July 11, the iPhone 3G was released and came pre-loaded with support for App Store. Initially apps could be free or paid, but then in 2009, Apple added the ability to add in-app purchases which quickly became the dominant way to monetize apps, especially games.After the success of Apple\\'s App Store and the launch of similar services by its competitors, the term \"app store\" has been adopted to refer to any similar service for mobile devices. However, Apple applied for a U.S. trademark on the term \"App Store\" in 2008, which was tentatively approved in early 2011. In June 2011, U.S. District Judge Phyllis Hamilton, who was presiding over Apple\\'s case against Amazon, said she would \"probably\" deny Apple\\'s motion to stop Amazon from using the \"App Store\" name. In July, Apple was denied preliminary injunction against Amazon\\'s Appstore by a federal judge.The term app has become a popular buzzword; in January 2011, app was awarded the honor of being 2010\\'s \"Word of the Year\" by the American Dialect Society. \"App\" has been used as shorthand for \"application\" since at least the late 1970s, and in product names since at least 2006, for example then-named Google Apps.Apple announced Mac App Store, a similar app distribution platform for its macOS personal computer operating system, in October 2010, with the official launch taking place in January 2011 with the release of its 10.6.6 \"Snow Leopard\" update.In February 2013, Apple informed developers that they could begin using appstore.com for links to their apps. In June at its developer conference, Apple announced an upcoming \"Kids\" section in App Store, a'),\n",
       " Document(page_content='appstore.com for links to their apps. In June at its developer conference, Apple announced an upcoming \"Kids\" section in App Store, a new section featuring apps categorized by age range, and the section was launched alongside the release of iOS 7 in September 2013.In 2016, multiple media outlets reported that apps had decreased significantly in popularity. Recode wrote that \"The app boom is over\", an editorial in TechCrunch stated that \"The air of hopelessness that surrounds the mobile app ecosystem is obvious and demoralizing\", and The Verge wrote that \"the original App Store model of selling apps for a buck or two looks antiquated\". Issues included consumer \"boredom\", a lack of app discoverabi Apple TV is a digital media player and microconsole developed and marketed by Apple Inc. It is a small piece of networking hardware that sends received media data such as video and audio to a TV or external display. Its media services include streaming media, TV Everywhere-based services, local media sources, and sports journalism and broadcasts.Second-generation and later models function only when connected via HDMI to an enhanced-definition or high-definition widescreen television. Since the fourth-generation model, Apple TV runs tvOS with multiple pre-installed apps.  In November 2019, Apple released Apple TV+ and Apple TV app a la carte.Apple TV lacks integrated controls and can only be controlled remotely, through a Siri Remote, iPhone or iPad, Apple Remote, or third-party infrared remotes complying with the fourth generation  Consumer Electronics Control standard. Background Before the Apple TV, Apple made a number of attempts to create TV-based devices: In 1993, Apple released the Macintosh TV in an attempt to enter the home-entertainment industry. The device had a 14-inch CRT screen and a TV tuner card. It was not a commercial success, with only 10,000 sold before its discontinuation in 1994. That year, the company developed the Apple Interactive Television Box, a collaboration with BT Group and Proximus Group that was never released to the public. Apple\\'s final major attempt before the Apple TV was the Apple Pippin in 1990s, a combination home game console and networked computer. Models = First generation =At a September 2006 Apple special event, Apple announced the first-generation Apple TV. It was originally announced as \"iTV\" to fit into their \"i\"-based product naming convention, but was renamed \"Apple TV\" before'),\n",
       " Document(page_content='It was originally announced as \"iTV\" to fit into their \"i\"-based product naming convention, but was renamed \"Apple TV\" before launch due to a trademark dispute with British broadcasting network ITV, which threatened legal action against Apple. Pre-orders began in January 2007 and it was released in March 2007. It is based on a Pentium M processor and ran a variant of Mac OS X Tiger, and included a 40 GB hard disk for storing content. It supported output up to 720p on HDTVs via HDMI, and supported some standard definition televisions via component video. At launch, Apple TV required a Mac or Windows-based PC running iTunes on the same network to sync or stream content to it.A model with a 160 GB hard drive was released in May 2007. The 40 GB version was discontinued in September 2009. In January 2008, it became a stand-alone device through a software update, which removed the requirement of iTunes syncing from separate computer, and allowed for media from services such as iTunes Store, MobileMe, and Flickr to be rented or purchased directly on the Apple TV.In July 2008, Apple released the software 2.1 update which added external recognition of iPhones and iPod Touches as alternative remote control devices to the Apple Remote. In September 2015, Apple discontinued iTunes support for the first-generation Apple TV, with accessibility being obstructed from such devices due to obsolete security standards.The first generation Apple TV can be modified into a makeshift intel Mac Mini, with a USB boot disk image being available online, and an install to the inbuilt hard drive possible by flashing the image to the hard drive through the USB booted disk. The device is not easily used unless a USB hub is installed, due to it only having one USB port.The first generation Apple TV has a 1 GHz Intel Pentium M CPU, and 256 MB of RAM. Neither the CPU or RAM can be upgraded without soldering, as both are soldered onto the motherboard. The device has one HDMI interface, one USB port, one 10/100 base T Ethernet port, and a Component video interface. Due to its thermal management design utilizing the upper case as a passive heat sink, the device gets warm when in use. A fan is used to cool the case, but it does not reach the CPU and is instead installed to cool the hard drive and installed power supply.= Second gene Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American'),\n",
       " Document(page_content='to cool the hard drive and installed power supply.= Second gene Steven Paul Jobs (February 24, 1955 – October 5, 2011) was an American businessman, inventor, and investor best known for co-founding the technology giant Apple Inc. Jobs was also the founder of NeXT and chairman and majority shareholder of Pixar. He was a pioneer of the personal computer revolution of the 1970s and 1980s, along with his early business partner and fellow Apple co-founder Steve Wozniak.Jobs was born in San Francisco in 1955 and adopted shortly afterwards. He attended Reed College in 1972 before withdrawing that same year. In 1974, he traveled through India, seeking enlightenment before later studying Zen Buddhism. He and Wozniak co-founded Apple in 1976 to further develop and sell Wozniak\\'s Apple I personal computer. Together, the duo gained fame and wealth a year later with production and sale of the Apple II, one of the first highly successful mass-produced microcomputers. Jobs saw the commercial potential of the Xerox Alto in 1979, which was mouse-driven and had a graphical user interface (GUI). This led to the development of the unsuccessful Apple Lisa in 1983, followed by the breakthrough Macintosh in 1984, the first mass-produced computer with a GUI. The Macintosh launched the desktop publishing industry in 1985 with the addition of the Apple LaserWriter, the first laser printer to feature vector graphics and PostScript.In 1985, Jobs departed Apple after a long power struggle with the company\\'s board and its then-CEO, John Sculley. That same year, Jobs took some Apple employees with him to found NeXT, a computer platform development company that specialized in computers for higher-education and business markets, serving as its CEO. In 1986, he helped develop the visual effects industry by funding the computer graphics division of Lucasfilm that eventually spun off independently as Pixar, which produced the first 3D computer-animated feature film Toy Story (1995) and became a leading animation studio, producing over 27 films since.In 1997, Jobs returned to Apple as CEO after the company\\'s acquisition of NeXT. He was largely responsible for reviving Apple, which was on the verge of bankruptcy. He worked closely with British designer Jony Ive to develop a line of products and services that had larger cultural ramifications, beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes'),\n",
       " Document(page_content='beginning with the \"Think different\" advertising campaign, and leading to the iMac, iTunes, Mac OS X, Apple Store, iPod, iTunes Store, iPhone, App Store, and iPad. In 2003, Jobs was diagnosed with a pancreatic neuroendocrine tumor. He died of respiratory arrest related to the tumor in 2011, and in 2022, was posthumously awarded the Presidential Medal of Freedom. Early life = Family =Steven Paul Jobs was born in San Francisco, California, on February 24, 1955, to Joanne Carole Schieble and Abdulfattah \"John\" Jandali (Arabic: عبد الفتاح الجندلي). Abdulfattah Jandali was born in a Muslim household to wealthy Syrian parents, the youngest of nine siblings. After obtaining his undergraduate degree at the American University of Beirut, Jandali pursued a PhD in political science at the University of Wisconsin. There, he met Joanne Schieble, an American Catholic of Swiss-German descent whose parents owned a mink farm and real estate in Green Bay. The two fell in love but faced opposition from Schieble\\'s father due to Jandali\\'s Muslim faith. When Schieble became pregnant, she arranged for a closed adoption, and travelled to San Francisco to give birth.Schieble requested that her son be adopted by college graduates. A lawyer and his wife were selected, but they withdrew after discovering that the baby was a boy, so Jobs was instead adopted by Paul Reinhold and Clara (née Hagopian) Jobs. Paul Jobs, an American of German descent, was the son of a dairy farmer from Washington County, Wisconsin. After dropping out of high school, he worked as a mechanic, then joined the US Coast Guard. When his ship was decommissioned at San Francisco, he bet he could find a wife within 2 weeks. He th The iPhone is a line of smartphones produced by Apple Inc. that use Apple\\'s own iOS mobile operating system. The first-generation iPhone was announced by then–Apple CEO Steve Jobs on January 9, 2007. Since then, Apple has annually released new iPhone models and iOS updates. As of November 1, 2018, more than 2.2 billion iPhones had been sold.The iPhone was the first mobile phone to use multi-touch technology. Since the iPhone\\'s launch, it has gained larger screen sizes, video-recording, waterproofing,'),\n",
       " Document(page_content='mobile phone to use multi-touch technology. Since the iPhone\\'s launch, it has gained larger screen sizes, video-recording, waterproofing, and many accessibility features. Up to the iPhone 8 and 8 Plus, iPhones had a single button on the front panel, with the iPhone 5s and later integrating a Touch ID fingerprint sensor. Since the iPhone X, iPhone models have switched to a nearly bezel-less front screen design with Face ID facial recognition, and app switching activated by gestures. Touch ID is still used for the budget iPhone SE series.The iPhone is one of the two largest smartphone platforms in the world alongside Android, and is a large part of the luxury market. The iPhone has generated large profits for Apple, making it one of the world\\'s most valuable publicly traded companies. The first-generation iPhone was described as a \"revolution\" for the mobile phone industry and subsequent models have also garnered praise. The iPhone has been credited with popularizing the smartphone and slate form factor, and with creating a large market for smartphone apps, or \"app economy\". As of January 2017, Apple\\'s App Store contained more than 2.2 million applications for the iPhone. History Development of an Apple smartphone began in 2004, when Apple started to gather a team of 1,000 employees led by hardware engineer Tony Fadell, software engineer Scott Forstall, and design officer Jony Ive, to work on the highly confidential \"Project Purple\".Then-Apple CEO Steve Jobs steered the original focus away from a tablet (which was later revisited in the form of the iPad) towards a phone. Apple created the device during a secretive collaboration with Cingular Wireless (later renamed AT&T Mobility) at an estimated development cost of US$150 million over thirty months. According to Jobs in 1998, the \"i\" word in \"iMac\" (and thereafter \"iPod\", \"iPhone\" and \"iPad\") stands for internet, individual, instruct, inform, and inspire.Apple rejected the \"design by committee\" approach that had yielded the Motorola ROKR E1, a largely unsuccessful \"iTunes phone\" made in collaboration with Motorola. Among other deficiencies, the ROKR E1\\'s firmware limited storage to only 100 iTunes songs to avoid competing with Apple\\'s iPod nano. Cingular gave Apple the liberty to develop the iPhone\\'s hardware and software in-house, a rare practice at the time, and paid Apple a fraction of its monthly service revenue'),\n",
       " Document(page_content=\"liberty to develop the iPhone's hardware and software in-house, a rare practice at the time, and paid Apple a fraction of its monthly service revenue (until the iPhone 3G), in exchange for four years of exclusive U.S. sales, until 2011.Jobs unveiled the first-generation iPhone to the public on January 9, 2007, at the Macworld 2007 convention at the Moscone Center in San Francisco. The iPhone incorporated a 3.5-inch multi-touch display with few hardware buttons, and ran the iPhone OS operating system with a touch-friendly interface, then marketed as a version of Mac OS X. It launched on June 29, 2007, at a starting price of US$499 in the United States, and required a two-year contract with AT&T.On July 11, 2008, at Apple's Worldwide Developers Conference (WWDC) 2008, Apple announced the iPhone 3G, and expanded its launch-day availability to twenty-two countries, and it was eventually released in 70 countries and territories. The iPhone 3G introduced faster 3G connectivity, and a lower starting price of US$199 (with a two-year AT&T contract). It proved commercially popular, overtaking Motorola RAZR V3 as the best selling cell phone in the US by the end of 2008. Its successor, the iPhone 3GS, was announced on June 8, 2009, at WWDC 2009, and introduced video recording functionality.The iPhone 4 was announced on June 7, 2010, at WWDC 2010,\")]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",
    "text_splitter = RecursiveCharacterTextSplitter.from_tiktoken_encoder(\n",
    "    chunk_size=500, chunk_overlap=30\n",
    ")\n",
    "split_docs = text_splitter.create_documents([docs])\n",
    "split_docs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.chains.combine_documents.stuff import StuffDocumentsChain\n",
    "from langchain.chains.llm import LLMChain\n",
    "from langchain.chains import MapReduceDocumentsChain, ReduceDocumentsChain\n",
    "from langchain.prompts import PromptTemplate\n",
    "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",
    "\n",
    "llm = Ollama(model=\"mistral\") # Define the mistral model\n",
    "\n",
    "# Define the map prompt template\n",
    "map_template = \"\"\"The following is a set of documents\n",
    "{all_data}\n",
    "Based on this list of docs, please find the important information from it (focus on entities and relationship)\n",
    "Helpful Answer:\"\"\"\n",
    "map_prompt = PromptTemplate.from_template(map_template)\n",
    "\n",
    "# Define the map_chain\n",
    "map_chain = LLMChain(llm=llm, prompt=map_prompt)\n",
    "\n",
    "reduce_template = \"\"\"The following is set of summaries:\n",
    "{all_data}\n",
    "Take these and distill it into a final, consolidated summary of the main themes. In one final paragraph\n",
    "Helpful Answer:\"\"\"\n",
    "reduce_prompt = PromptTemplate.from_template(reduce_template)\n",
    "reduce_chain = LLMChain(llm=llm, prompt=reduce_prompt)\n",
    "\n",
    "combine_documents_chain = StuffDocumentsChain(\n",
    "    llm_chain=reduce_chain,\n",
    "    document_variable_name=\"all_data\"  # This should match the variable name in reduce_prompt\n",
    ")\n",
    "\n",
    "# Combines and iteravely reduces the mapped documents\n",
    "reduce_documents_chain = ReduceDocumentsChain(\n",
    "    # This is final chain that is called.\n",
    "    combine_documents_chain=combine_documents_chain,\n",
    "    # If documents exceed context for `StuffDocumentsChain`\n",
    "    collapse_documents_chain=combine_documents_chain,\n",
    "    # The maximum number of tokens to group documents into.\n",
    "    token_max=1024,\n",
    ")\n",
    "\n",
    "# Combining documents by mapping a chain over them, then combining results\n",
    "map_reduce_chain = MapReduceDocumentsChain(\n",
    "    # Map chain\n",
    "    llm_chain=map_chain,\n",
    "    # Reduce chain\n",
    "    reduce_documents_chain=reduce_documents_chain,\n",
    "    # The variable name in the llm_chain to put the documents in\n",
    "    document_variable_name=\"all_data\",\n",
    "    # Return the results of the map steps in the output\n",
    "    return_intermediate_steps=False,\n",
    ")\n",
    "\n",
    "\n",
    "# Run the MapReduce Chain\n",
    "summarization_results = map_reduce_chain.run(split_docs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "file_path = \"C:/Users/Geraldus Wilsen/Documents/Portfolio/KnowledgeGraphLLM/tutorial/2/summary.txt\"\n",
    "\n",
    "with open(file_path, 'a') as file:\n",
    "    file.write(summarization_results)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Extract Information"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_groq import ChatGroq\n",
    "\n",
    "groq_api = os.getenv(\"GROQ_API_KEY\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "entity_types = ['person','school','award','company','product','characteristic']\n",
    "relation_types = ['alumniOf','worksFor','hasAward','isProducedBy','hasCharacteristic','acquired','hasProject','isFounderOf']\n",
    "\n",
    "system_prompt = PromptTemplate(\n",
    "    template = \"\"\"\n",
    "    You are a top-tier algorithm designed for extracting information in structured formats to build a knowledge graph.\n",
    "    Your task is to identify the entities and relations requested with the user prompt, from a given text.\n",
    "    You must generate the output in a JSON containing a list with JSON objects having the following keys: \"head\", \"head_type\", \"relation\", \"tail\", and \"tail_type\".\n",
    "    The \"head\" key must contain the text of the extracted entity with one of the types from the provided list in the user prompt. \n",
    "    The \"head_type\" key must contain the type of the extracted head entity which must be one of the types from {entity_types}.\n",
    "    The \"relation\" key must contain the type of relation between the \"head\" and the \"tail\" which must be one of the relations from {relation_types}.\n",
    "    The \"tail\" key must represent the text of an extracted entity which is the tail of the relation, and the \"tail_type\" key must contain the type of the tail entity from {entity_types}. \n",
    "    Attempt to extract as many entities and relations as you can. \n",
    "    \n",
    "    IMPORTANT NOTES:\n",
    "    - Don't add any explanation and text. \n",
    "    \"\"\",\n",
    "    input_variables=[\"entity_types\",\"relation_types\"],\n",
    ")\n",
    "\n",
    "\n",
    "system_message_prompt = SystemMessagePromptTemplate(prompt = system_prompt)\n",
    "\n",
    "examples = [\n",
    "        {\n",
    "            \"text\":\"Adam is a software engineer in Microsoft since 2009, and last year he got an award as the Best Talent\" ,    \n",
    "            \"head\": \"Adam\",\n",
    "            \"head_type\": \"person\",\n",
    "            \"relation\": \"worksFor\",\n",
    "            \"tail\": \"Microsoft\",\n",
    "            \"tail_type\": \"company\"\n",
    "        },\n",
    "        {\n",
    "            \"text\":\"Adam is a software engineer in Microsoft since 2009, and last year he got an award as the Best Talent\" ,    \n",
    "            \"head\": \"Adam\",\n",
    "            \"head_type\": \"person\",\n",
    "            \"relation\": \"hasAward\",\n",
    "            \"tail\": \"Best Talent\",\n",
    "            \"tail_type\": \"award\"\n",
    "        },\n",
    "        {\n",
    "            \"text\":\"Microsoft is a tech company that provide several products such as Microsoft Word\" ,    \n",
    "            \"head\": \"Microsoft Word\",\n",
    "            \"head_type\": \"product\",\n",
    "            \"relation\": \"isproducedBy\",\n",
    "            \"tail\": \"Microsoft\",\n",
    "            \"tail_type\": \"company\"\n",
    "        },\n",
    "        {\n",
    "            \"text\":\"Microsoft Word is a lightweight app that accessible offline\" ,    \n",
    "            \"head\": \"Microsoft Word\",\n",
    "            \"head_type\": \"product\",\n",
    "            \"relation\": \"hasCharacteristic\",\n",
    "            \"tail\": \"lightweight app\",\n",
    "            \"tail_type\": \"characteristic\"\n",
    "        },\n",
    "        {\n",
    "            \"text\":\"Microsoft Word is a lightweight app that accessible offline\" ,    \n",
    "            \"head\": \"Microsoft Word\",\n",
    "            \"head_type\": \"product\",\n",
    "            \"relation\": \"hasCharacteristic\",\n",
    "            \"tail\": \"accesible offline\",\n",
    "            \"tail_type\": \"characteristic\"\n",
    "        },\n",
    "    ]\n",
    "\n",
    "class ExtractedInfo(BaseModel):\n",
    "    head: str = Field(description=\"extracted first or head entity like Microsoft, Apple, John\")\n",
    "    head_type: str = Field(description=\"type of the extracted head entity like person, company, etc\")\n",
    "    relation: str = Field(description=\"relation between the head and the tail entities\")\n",
    "    tail: str = Field(description=\"extracted second or tail entity like Microsoft, Apple, John\")\n",
    "    tail_type: str = Field(description=\"type of the extracted tail entity like person, company, etc\")\n",
    "    \n",
    "parser = JsonOutputParser(pydantic_object=ExtractedInfo)\n",
    "\n",
    "human_prompt = PromptTemplate(\n",
    "    template = \"\"\" Based on the following example, extract entities and relations from the provided text.\\n\\n\n",
    "\n",
    "    Use the following entity types, don't use other entity that is not defined below:\n",
    "    # ENTITY TYPES:\n",
    "    {entity_types}\n",
    "\n",
    "    Use the following relation types, don't use other relation that is not defined below:\n",
    "    # RELATION TYPES:\n",
    "    {relation_types}\n",
    "\n",
    "    Below are a number of examples of text and their extracted entities and relationshhips.\n",
    "    {examples}\n",
    "\n",
    "    For the following text, generate extract entitites and relations as in the provided example.\\n{format_instructions}\\nText: {text}\"\"\",\n",
    "    input_variables=[\"entity_types\",\"relation_types\",\"examples\",\"text\"],\n",
    "    partial_variables={\"format_instructions\": parser.get_format_instructions()},\n",
    ")\n",
    "\n",
    "human_message_prompt = HumanMessagePromptTemplate(prompt=human_prompt)\n",
    "\n",
    "chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])\n",
    "\n",
    "\n",
    "# model = ChatOllama(model = \"mistral\",temperature=0)\n",
    "# model = ChatOllama(model = \"llama3\",temperature=0)\n",
    "model = ChatGroq(temperature=0, model_name=\"llama3-70b-8192\")\n",
    "chain = LLMChain(llm=model, prompt=chat_prompt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'The output should be formatted as a JSON instance that conforms to the JSON schema below.\\n\\nAs an example, for the schema {\"properties\": {\"foo\": {\"title\": \"Foo\", \"description\": \"a list of strings\", \"type\": \"array\", \"items\": {\"type\": \"string\"}}}, \"required\": [\"foo\"]}\\nthe object {\"foo\": [\"bar\", \"baz\"]} is a well-formatted instance of the schema. The object {\"properties\": {\"foo\": [\"bar\", \"baz\"]}} is not well-formatted.\\n\\nHere is the output schema:\\n```\\n{\"properties\": {\"head\": {\"title\": \"Head\", \"description\": \"extracted first or head entity like Microsoft, Apple, John\", \"type\": \"string\"}, \"head_type\": {\"title\": \"Head Type\", \"description\": \"type of the extracted head entity like person, company, etc\", \"type\": \"string\"}, \"relation\": {\"title\": \"Relation\", \"description\": \"relation between the head and the tail entities\", \"type\": \"string\"}, \"tail\": {\"title\": \"Tail\", \"description\": \"extracted second or tail entity like Microsoft, Apple, John\", \"type\": \"string\"}, \"tail_type\": {\"title\": \"Tail Type\", \"description\": \"type of the extracted tail entity like person, company, etc\", \"type\": \"string\"}}, \"required\": [\"head\", \"head_type\", \"relation\", \"tail\", \"tail_type\"]}\\n```'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "parser.get_format_instructions()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "file_path = \"C:/Users/Geraldus Wilsen/Documents/Portfolio/KnowledgeGraphLLM/tutorial/2/clean_summary.txt\"\n",
    "with open(file_path, 'r') as file:\n",
    "    # Read the entire file contents into a string\n",
    "    file_contents = file.read()\n",
    "\n",
    "# Split the file contents into sentences\n",
    "sentences = file_contents.split('. ')\n",
    "\n",
    "result = []\n",
    "# Iterate over each sentence\n",
    "for sentence in sentences:\n",
    "    # Process each sentence\n",
    "    response  = chain.run(entity_types = entity_types, relation_types = relation_types, examples = examples, text = sentence)\n",
    "    print(response)\n",
    "    try:\n",
    "        result.extend(eval(response))\n",
    "    except:\n",
    "        pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'head': 'Tim Cook',\n",
       "  'head_type': 'person',\n",
       "  'relation': 'worksFor',\n",
       "  'tail': 'Apple',\n",
       "  'tail_type': 'company'},\n",
       " {'head': 'He',\n",
       "  'head_type': 'person',\n",
       "  'relation': 'led',\n",
       "  'tail': 'inventory reduction measures',\n",
       "  'tail_type': 'characteristic'},\n",
       " {'head': 'He',\n",
       "  'head_type': 'person',\n",
       "  'relation': 'led',\n",
       "  'tail': 'long-term investments in flash memory',\n",
       "  'tail_type': 'characteristic'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'hasProduct',\n",
       "  'tail': 'iPod Nano',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'hasProduct',\n",
       "  'tail': 'iPhone',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'hasProduct',\n",
       "  'tail': 'iPad',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'produced',\n",
       "  'tail': 'Apple I',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'produced',\n",
       "  'tail': 'Apple II',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'produced',\n",
       "  'tail': 'Lisa',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'produced',\n",
       "  'tail': 'Macintosh',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Steve Jobs',\n",
       "  'head_type': 'person',\n",
       "  'relation': 'worksFor',\n",
       "  'tail': 'Apple',\n",
       "  'tail_type': 'company'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'operates',\n",
       "  'tail': 'App Store',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'acquired',\n",
       "  'tail': 'Placebase',\n",
       "  'tail_type': 'company'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'hasProject',\n",
       "  'tail': 'Apple Maps',\n",
       "  'tail_type': 'product'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'hasCharacteristic',\n",
       "  'tail': 'trailblazing technology company',\n",
       "  'tail_type': 'characteristic'},\n",
       " {'head': 'Apple',\n",
       "  'head_type': 'company',\n",
       "  'relation': 'hasCharacteristic',\n",
       "  'tail': 'first US company valued over $3 trillion',\n",
       "  'tail_type': 'characteristic'}]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to Cypher Query"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'head': 'Tim Cook', 'head_type': 'person', 'relation': 'worksFor', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'led', 'tail': 'inventory reduction measures', 'tail_type': 'characteristic'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'led', 'tail': 'long-term investments in flash memory', 'tail_type': 'characteristic'}, {'head': 'iPod Nano', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'iPhone', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'iPad', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'iPod Nano', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'alumniOf', 'tail': 'Auburn University', 'tail_type': 'school'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'alumniOf', 'tail': 'Duke University', 'tail_type': 'school'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'hasAward', 'tail': 'Financial Times Person of the Year', 'tail_type': 'award'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'hasAward', 'tail': 'Ripple of Change Award', 'tail_type': 'award'}, {'head': 'Tim Cook', 'head_type': 'person', 'relation': 'hasAward', 'tail': \"Fortune's World's Greatest Leader\", 'tail_type': 'award'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'isFoundedBy', 'tail': 'Steve Wozniak', 'tail_type': 'person'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'isFoundedBy', 'tail': 'Steve Jobs', 'tail_type': 'person'}, {'head': 'Apple I', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Apple II', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Lisa', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Macintosh', 'head_type': 'product', 'relation': 'isProducedBy', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Steve Jobs', 'head_type': 'person', 'relation': 'worksFor', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Steve Jobs', 'head_type': 'person', 'relation': 'left', 'tail': 'Apple', 'tail_type': 'company'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'acquired', 'tail': 'NeXT', 'tail_type': 'company'}, {'head': 'NeXT', 'head_type': 'company', 'relation': 'hasTechnology', 'tail': 'technology', 'tail_type': 'characteristic'}, {'head': 'Macintosh', 'head_type': 'product', 'relation': 'hasCharacteristic', 'tail': 'graphical user interface-based system', 'tail_type': 'characteristic'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'collaboratedWith', 'tail': 'Cingular', 'tail_type': 'company'}, {'head': 'iPhone', 'head_type': 'product', 'relation': 'hasCharacteristic', 'tail': 'multi-touch technology', 'tail_type': 'characteristic'}, {'head': 'iPhone', 'head_type': 'product', 'relation': 'hasCharacteristic', 'tail': 'Touch ID', 'tail_type': 'characteristic'}, {'head': 'iPhone', 'head_type': 'product', 'relation': 'hasCharacteristic', 'tail': 'Face ID', 'tail_type': 'characteristic'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'operates', 'tail': 'App Store', 'tail_type': 'product'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'acquired', 'tail': 'Placebase', 'tail_type': 'company'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'hasProject', 'tail': 'Apple Maps', 'tail_type': 'product'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'hasProject', 'tail': 'Project Titan', 'tail_type': 'project'}, {'head': 'Project Titan', 'head_type': 'project', 'relation': 'hasCharacteristic', 'tail': 'electric and self-driving car technology', 'tail_type': 'characteristic'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'hasCharacteristic', 'tail': 'trailblazing technology company', 'tail_type': 'characteristic'}, {'head': 'Apple', 'head_type': 'company', 'relation': 'hasCharacteristic', 'tail': 'first US company valued over $3 trillion', 'tail_type': 'characteristic'}]\n"
     ]
    }
   ],
   "source": [
    "with open(\"C:/Users/Geraldus Wilsen/Documents/Portfolio/KnowledgeGraphLLM/tutorial/2/clean_result.txt\", \"r\") as file:\n",
    "    content = file.read()\n",
    "entity_relations = eval(content)\n",
    "print(entity_relations)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>head_type</th>\n",
       "      <th>relation</th>\n",
       "      <th>tail</th>\n",
       "      <th>tail_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>worksFor</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>led</td>\n",
       "      <td>inventory reduction measures</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>led</td>\n",
       "      <td>long-term investments in flash memory</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>iPod Nano</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>iPhone</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>iPad</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>iPod Nano</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>alumniOf</td>\n",
       "      <td>Auburn University</td>\n",
       "      <td>school</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>alumniOf</td>\n",
       "      <td>Duke University</td>\n",
       "      <td>school</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>hasAward</td>\n",
       "      <td>Financial Times Person of the Year</td>\n",
       "      <td>award</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>hasAward</td>\n",
       "      <td>Ripple of Change Award</td>\n",
       "      <td>award</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Tim Cook</td>\n",
       "      <td>person</td>\n",
       "      <td>hasAward</td>\n",
       "      <td>Fortune's World's Greatest Leader</td>\n",
       "      <td>award</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>isFoundedBy</td>\n",
       "      <td>Steve Wozniak</td>\n",
       "      <td>person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>isFoundedBy</td>\n",
       "      <td>Steve Jobs</td>\n",
       "      <td>person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Apple I</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Apple II</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Lisa</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Macintosh</td>\n",
       "      <td>product</td>\n",
       "      <td>isProducedBy</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Steve Jobs</td>\n",
       "      <td>person</td>\n",
       "      <td>worksFor</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Steve Jobs</td>\n",
       "      <td>person</td>\n",
       "      <td>left</td>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>acquired</td>\n",
       "      <td>NeXT</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>NeXT</td>\n",
       "      <td>company</td>\n",
       "      <td>hasTechnology</td>\n",
       "      <td>technology</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Macintosh</td>\n",
       "      <td>product</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>graphical user interface-based system</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>collaboratedWith</td>\n",
       "      <td>Cingular</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>iPhone</td>\n",
       "      <td>product</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>multi-touch technology</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>iPhone</td>\n",
       "      <td>product</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>Touch ID</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>iPhone</td>\n",
       "      <td>product</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>Face ID</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>operates</td>\n",
       "      <td>App Store</td>\n",
       "      <td>product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>acquired</td>\n",
       "      <td>Placebase</td>\n",
       "      <td>company</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>hasProject</td>\n",
       "      <td>Apple Maps</td>\n",
       "      <td>product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>hasProject</td>\n",
       "      <td>Project Titan</td>\n",
       "      <td>project</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Project Titan</td>\n",
       "      <td>project</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>electric and self-driving car technology</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>trailblazing technology company</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Apple</td>\n",
       "      <td>company</td>\n",
       "      <td>hasCharacteristic</td>\n",
       "      <td>first US company valued over $3 trillion</td>\n",
       "      <td>characteristic</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             head head_type           relation  \\\n",
       "0        Tim Cook    person           worksFor   \n",
       "1        Tim Cook    person                led   \n",
       "2        Tim Cook    person                led   \n",
       "3       iPod Nano   product       isProducedBy   \n",
       "4          iPhone   product       isProducedBy   \n",
       "5            iPad   product       isProducedBy   \n",
       "6       iPod Nano   product       isProducedBy   \n",
       "7        Tim Cook    person           alumniOf   \n",
       "8        Tim Cook    person           alumniOf   \n",
       "9        Tim Cook    person           hasAward   \n",
       "10       Tim Cook    person           hasAward   \n",
       "11       Tim Cook    person           hasAward   \n",
       "12          Apple   company        isFoundedBy   \n",
       "13          Apple   company        isFoundedBy   \n",
       "14        Apple I   product       isProducedBy   \n",
       "15       Apple II   product       isProducedBy   \n",
       "16           Lisa   product       isProducedBy   \n",
       "17      Macintosh   product       isProducedBy   \n",
       "18     Steve Jobs    person           worksFor   \n",
       "19     Steve Jobs    person               left   \n",
       "20          Apple   company           acquired   \n",
       "21           NeXT   company      hasTechnology   \n",
       "22      Macintosh   product  hasCharacteristic   \n",
       "23          Apple   company   collaboratedWith   \n",
       "24         iPhone   product  hasCharacteristic   \n",
       "25         iPhone   product  hasCharacteristic   \n",
       "26         iPhone   product  hasCharacteristic   \n",
       "27          Apple   company           operates   \n",
       "28          Apple   company           acquired   \n",
       "29          Apple   company         hasProject   \n",
       "30          Apple   company         hasProject   \n",
       "31  Project Titan   project  hasCharacteristic   \n",
       "32          Apple   company  hasCharacteristic   \n",
       "33          Apple   company  hasCharacteristic   \n",
       "\n",
       "                                        tail       tail_type  \n",
       "0                                      Apple         company  \n",
       "1               inventory reduction measures  characteristic  \n",
       "2      long-term investments in flash memory  characteristic  \n",
       "3                                      Apple         company  \n",
       "4                                      Apple         company  \n",
       "5                                      Apple         company  \n",
       "6                                      Apple         company  \n",
       "7                          Auburn University          school  \n",
       "8                            Duke University          school  \n",
       "9         Financial Times Person of the Year           award  \n",
       "10                    Ripple of Change Award           award  \n",
       "11         Fortune's World's Greatest Leader           award  \n",
       "12                             Steve Wozniak          person  \n",
       "13                                Steve Jobs          person  \n",
       "14                                     Apple         company  \n",
       "15                                     Apple         company  \n",
       "16                                     Apple         company  \n",
       "17                                     Apple         company  \n",
       "18                                     Apple         company  \n",
       "19                                     Apple         company  \n",
       "20                                      NeXT         company  \n",
       "21                                technology  characteristic  \n",
       "22     graphical user interface-based system  characteristic  \n",
       "23                                  Cingular         company  \n",
       "24                    multi-touch technology  characteristic  \n",
       "25                                  Touch ID  characteristic  \n",
       "26                                   Face ID  characteristic  \n",
       "27                                 App Store         product  \n",
       "28                                 Placebase         company  \n",
       "29                                Apple Maps         product  \n",
       "30                             Project Titan         project  \n",
       "31  electric and self-driving car technology  characteristic  \n",
       "32           trailblazing technology company  characteristic  \n",
       "33  first US company valued over $3 trillion  characteristic  "
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(entity_relations)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[('Steve Jobs', 'person'), ('Macintosh', 'product'), (\"Fortune's World's Greatest Leader\", 'award'), ('technology', 'characteristic'), ('Apple', 'company'), ('Duke University', 'school'), ('Ripple of Change Award', 'award'), ('iPhone', 'product'), ('Apple Maps', 'product'), ('Lisa', 'product'), ('Financial Times Person of the Year', 'award'), ('electric and self-driving car technology', 'characteristic'), ('Tim Cook', 'person'), ('NeXT', 'company'), ('Steve Wozniak', 'person'), ('trailblazing technology company', 'characteristic'), ('iPod Nano', 'product'), ('Apple I', 'product'), ('graphical user interface-based system', 'characteristic'), ('multi-touch technology', 'characteristic'), ('Project Titan', 'project'), ('first US company valued over $3 trillion', 'characteristic'), ('Placebase', 'company'), ('Auburn University', 'school'), ('Cingular', 'company'), ('long-term investments in flash memory', 'characteristic'), ('Face ID', 'characteristic'), ('Touch ID', 'characteristic'), ('App Store', 'product'), ('iPad', 'product'), ('Apple II', 'product'), ('inventory reduction measures', 'characteristic')]\n"
     ]
    }
   ],
   "source": [
    "unique_entities = set()\n",
    "for item in entity_relations:\n",
    "    unique_entities.add((item['head'], item['head_type']))\n",
    "    unique_entities.add((item['tail'], item['tail_type']))\n",
    "\n",
    "unique_entities_list = list(unique_entities)\n",
    "print(unique_entities_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"cypher_query.txt\", \"a\") as file:\n",
    "    for item in unique_entities_list:\n",
    "        label, entity = item\n",
    "        id = label.replace(\" \",\"_\").replace(\"-\",\"\").replace(\"'\",\"\").lower()\n",
    "        merge_statement = f\"\"\"MERGE ({id}:{entity} {{id: \"{label}\"}})\\n\"\"\"\n",
    "        file.write(merge_statement)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"cypher_query.txt\", \"a\") as file:\n",
    "    for item in entity_relations:\n",
    "        head = item['head'].replace(\" \",\"_\").replace(\"-\",\"\").replace(\"'\",\"\").lower()\n",
    "        tail = item['tail'].replace(\" \",\"_\").replace(\"-\",\"\").replace(\"'\",\"\").lower()\n",
    "        cypher = f\"\"\"MERGE ({head})-[:{item['relation']}]->({tail})\\n\"\"\"\n",
    "        file.write(cypher)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Neo4j \n",
    "neo4j_url = os.getenv(\"NEO4J_CONNECTION_URL\")\n",
    "neo4j_user = os.getenv(\"NEO4J_USER\")\n",
    "neo4j_password = os.getenv(\"NEO4J_PASSWORD\")\n",
    "\n",
    "# https://api.python.langchain.com/en/latest/graphs/langchain_community.graphs.neo4j_graph.Neo4jGraph.html\n",
    "graph = Neo4jGraph(neo4j_url,neo4j_user,neo4j_password)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Node properties are the following:\n",
      "\n",
      "Relationship properties are the following:\n",
      "\n",
      "The relationships are the following:\n",
      "\n"
     ]
    }
   ],
   "source": [
    "graph.refresh_schema()\n",
    "print(graph.schema)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "with open(\"C:/Users/Geraldus Wilsen/Documents/Portfolio/KnowledgeGraphLLM/tutorial/2/cypher_query.txt\", \"r\") as file:\n",
    "    queries = file.read()\n",
    "\n",
    "graph.query(queries)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Node properties are the following:\n",
      "person {id: STRING},product {id: STRING},award {id: STRING},characteristic {id: STRING},company {id: STRING},school {id: STRING},project {id: STRING}\n",
      "Relationship properties are the following:\n",
      "\n",
      "The relationships are the following:\n",
      "(:person)-[:worksFor]->(:company),(:person)-[:left]->(:company),(:person)-[:led]->(:characteristic),(:person)-[:hasAward]->(:award),(:person)-[:alumniOf]->(:school),(:product)-[:isProducedBy]->(:company),(:product)-[:hasCharacteristic]->(:characteristic),(:company)-[:isFoundedBy]->(:person),(:company)-[:acquired]->(:company),(:company)-[:hasCharacteristic]->(:characteristic),(:company)-[:collaboratedWith]->(:company),(:company)-[:operates]->(:product),(:company)-[:hasProject]->(:product),(:company)-[:hasProject]->(:project),(:company)-[:hasTechnology]->(:characteristic),(:project)-[:hasCharacteristic]->(:characteristic)\n"
     ]
    }
   ],
   "source": [
    "graph.refresh_schema()\n",
    "print(graph.schema)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
